]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP VTY interface. |
2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
6 | GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by the | |
8 | Free Software Foundation; either version 2, or (at your option) any | |
9 | later version. | |
10 | ||
11 | GNU Zebra is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
21 | #include <zebra.h> | |
22 | ||
23 | #include "command.h" | |
24 | #include "prefix.h" | |
25 | #include "plist.h" | |
26 | #include "buffer.h" | |
27 | #include "linklist.h" | |
28 | #include "stream.h" | |
29 | #include "thread.h" | |
30 | #include "log.h" | |
3b8b1855 | 31 | #include "memory.h" |
4bf6a362 | 32 | #include "hash.h" |
718e3744 | 33 | |
34 | #include "bgpd/bgpd.h" | |
4bf6a362 | 35 | #include "bgpd/bgp_advertise.h" |
718e3744 | 36 | #include "bgpd/bgp_attr.h" |
37 | #include "bgpd/bgp_aspath.h" | |
38 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
39 | #include "bgpd/bgp_ecommunity.h" |
40 | #include "bgpd/bgp_damp.h" | |
718e3744 | 41 | #include "bgpd/bgp_debug.h" |
e0701b79 | 42 | #include "bgpd/bgp_fsm.h" |
718e3744 | 43 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 44 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 45 | #include "bgpd/bgp_open.h" |
4bf6a362 | 46 | #include "bgpd/bgp_regex.h" |
718e3744 | 47 | #include "bgpd/bgp_route.h" |
48 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 49 | #include "bgpd/bgp_table.h" |
94f2b392 | 50 | #include "bgpd/bgp_vty.h" |
165b5fff | 51 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 52 | #include "bgpd/bgp_packet.h" |
718e3744 | 53 | |
18a6dce6 | 54 | extern struct in_addr router_id_zebra; |
55 | ||
718e3744 | 56 | /* Utility function to get address family from current node. */ |
57 | afi_t | |
58 | bgp_node_afi (struct vty *vty) | |
59 | { | |
25ffbdc1 | 60 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 61 | return AFI_IP6; |
62 | return AFI_IP; | |
63 | } | |
64 | ||
65 | /* Utility function to get subsequent address family from current | |
66 | node. */ | |
67 | safi_t | |
68 | bgp_node_safi (struct vty *vty) | |
69 | { | |
70 | if (vty->node == BGP_VPNV4_NODE) | |
71 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 72 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 73 | return SAFI_MULTICAST; |
74 | return SAFI_UNICAST; | |
75 | } | |
76 | ||
94f2b392 | 77 | static int |
718e3744 | 78 | peer_address_self_check (union sockunion *su) |
79 | { | |
80 | struct interface *ifp = NULL; | |
81 | ||
82 | if (su->sa.sa_family == AF_INET) | |
83 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
84 | #ifdef HAVE_IPV6 | |
85 | else if (su->sa.sa_family == AF_INET6) | |
86 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); | |
87 | #endif /* HAVE IPV6 */ | |
88 | ||
89 | if (ifp) | |
90 | return 1; | |
91 | ||
92 | return 0; | |
93 | } | |
94 | ||
95 | /* Utility function for looking up peer from VTY. */ | |
94f2b392 | 96 | static struct peer * |
fd79ac91 | 97 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 98 | { |
99 | int ret; | |
100 | struct bgp *bgp; | |
101 | union sockunion su; | |
102 | struct peer *peer; | |
103 | ||
104 | bgp = vty->index; | |
105 | ||
106 | ret = str2sockunion (ip_str, &su); | |
107 | if (ret < 0) | |
108 | { | |
a80beece DS |
109 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
110 | if (!peer) | |
111 | { | |
112 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
113 | return NULL; | |
114 | } | |
718e3744 | 115 | } |
a80beece | 116 | else |
718e3744 | 117 | { |
a80beece DS |
118 | peer = peer_lookup (bgp, &su); |
119 | if (! peer) | |
120 | { | |
121 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
122 | VTY_NEWLINE); | |
123 | return NULL; | |
124 | } | |
718e3744 | 125 | } |
126 | return peer; | |
127 | } | |
128 | ||
129 | /* Utility function for looking up peer or peer group. */ | |
94f2b392 | 130 | static struct peer * |
fd79ac91 | 131 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 132 | { |
133 | int ret; | |
134 | struct bgp *bgp; | |
135 | union sockunion su; | |
136 | struct peer *peer; | |
137 | struct peer_group *group; | |
138 | ||
139 | bgp = vty->index; | |
140 | ||
141 | ret = str2sockunion (peer_str, &su); | |
142 | if (ret == 0) | |
143 | { | |
144 | peer = peer_lookup (bgp, &su); | |
145 | if (peer) | |
146 | return peer; | |
147 | } | |
148 | else | |
149 | { | |
a80beece DS |
150 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
151 | if (peer) | |
152 | return peer; | |
153 | ||
718e3744 | 154 | group = peer_group_lookup (bgp, peer_str); |
155 | if (group) | |
156 | return group->conf; | |
157 | } | |
158 | ||
159 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
160 | VTY_NEWLINE); | |
161 | ||
162 | return NULL; | |
163 | } | |
164 | ||
94f2b392 | 165 | static int |
718e3744 | 166 | bgp_vty_return (struct vty *vty, int ret) |
167 | { | |
fd79ac91 | 168 | const char *str = NULL; |
718e3744 | 169 | |
170 | switch (ret) | |
171 | { | |
172 | case BGP_ERR_INVALID_VALUE: | |
173 | str = "Invalid value"; | |
174 | break; | |
175 | case BGP_ERR_INVALID_FLAG: | |
176 | str = "Invalid flag"; | |
177 | break; | |
178 | case BGP_ERR_PEER_INACTIVE: | |
179 | str = "Activate the neighbor for the address family first"; | |
180 | break; | |
181 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
182 | str = "Invalid command for a peer-group member"; | |
183 | break; | |
184 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
185 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
186 | break; | |
187 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
188 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
189 | break; | |
190 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
191 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
192 | break; | |
193 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
194 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
195 | break; | |
196 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
197 | str = "No activate for an individual peer-group member is invalid"; | |
198 | break; | |
199 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
200 | str = "Activate the peer-group for the address family first"; | |
201 | break; | |
202 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
203 | str = "Specify remote-as or peer-group remote AS first"; | |
204 | break; | |
205 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
206 | str = "Cannot change the peer-group. Deconfigure first"; | |
207 | break; | |
208 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
209 | str = "Cannot have different peer-group for the neighbor"; | |
210 | break; | |
211 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
212 | str = "Prefix/distribute list can not co-exist"; | |
213 | break; | |
214 | case BGP_ERR_NOT_INTERNAL_PEER: | |
215 | str = "Invalid command. Not an internal neighbor"; | |
216 | break; | |
217 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 218 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 219 | break; |
220 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
221 | str = "Local-AS allowed only for EBGP peers"; | |
222 | break; | |
223 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
224 | str = "Cannot have local-as same as BGP AS number"; | |
225 | break; | |
0df7c91f PJ |
226 | case BGP_ERR_TCPSIG_FAILED: |
227 | str = "Error while applying TCP-Sig to session(s)"; | |
228 | break; | |
fa411a21 NH |
229 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
230 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
231 | break; | |
f5a4827d SH |
232 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
233 | str = "ttl-security only allowed for EBGP peers"; | |
234 | break; | |
c7122e14 DS |
235 | case BGP_ERR_AS_OVERRIDE: |
236 | str = "as-override cannot be configured for IBGP peers"; | |
237 | break; | |
718e3744 | 238 | } |
239 | if (str) | |
240 | { | |
241 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
242 | return CMD_WARNING; | |
243 | } | |
244 | return CMD_SUCCESS; | |
245 | } | |
246 | ||
247 | /* BGP global configuration. */ | |
248 | ||
249 | DEFUN (bgp_multiple_instance_func, | |
250 | bgp_multiple_instance_cmd, | |
251 | "bgp multiple-instance", | |
252 | BGP_STR | |
253 | "Enable bgp multiple instance\n") | |
254 | { | |
255 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
256 | return CMD_SUCCESS; | |
257 | } | |
258 | ||
259 | DEFUN (no_bgp_multiple_instance, | |
260 | no_bgp_multiple_instance_cmd, | |
261 | "no bgp multiple-instance", | |
262 | NO_STR | |
263 | BGP_STR | |
264 | "BGP multiple instance\n") | |
265 | { | |
266 | int ret; | |
267 | ||
268 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
269 | if (ret < 0) | |
270 | { | |
271 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
272 | return CMD_WARNING; | |
273 | } | |
274 | return CMD_SUCCESS; | |
275 | } | |
276 | ||
277 | DEFUN (bgp_config_type, | |
278 | bgp_config_type_cmd, | |
279 | "bgp config-type (cisco|zebra)", | |
280 | BGP_STR | |
281 | "Configuration type\n" | |
282 | "cisco\n" | |
283 | "zebra\n") | |
284 | { | |
285 | if (strncmp (argv[0], "c", 1) == 0) | |
286 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
287 | else | |
288 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
289 | ||
290 | return CMD_SUCCESS; | |
291 | } | |
292 | ||
293 | DEFUN (no_bgp_config_type, | |
294 | no_bgp_config_type_cmd, | |
295 | "no bgp config-type", | |
296 | NO_STR | |
297 | BGP_STR | |
298 | "Display configuration type\n") | |
299 | { | |
300 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
301 | return CMD_SUCCESS; | |
302 | } | |
303 | ||
304 | DEFUN (no_synchronization, | |
305 | no_synchronization_cmd, | |
306 | "no synchronization", | |
307 | NO_STR | |
308 | "Perform IGP synchronization\n") | |
309 | { | |
310 | return CMD_SUCCESS; | |
311 | } | |
312 | ||
313 | DEFUN (no_auto_summary, | |
314 | no_auto_summary_cmd, | |
315 | "no auto-summary", | |
316 | NO_STR | |
317 | "Enable automatic network number summarization\n") | |
318 | { | |
319 | return CMD_SUCCESS; | |
320 | } | |
3d515fd9 | 321 | |
322 | DEFUN_DEPRECATED (neighbor_version, | |
323 | neighbor_version_cmd, | |
324 | NEIGHBOR_CMD "version (4|4-)", | |
325 | NEIGHBOR_STR | |
326 | NEIGHBOR_ADDR_STR | |
327 | "Set the BGP version to match a neighbor\n" | |
328 | "Neighbor's BGP version\n") | |
329 | { | |
330 | return CMD_SUCCESS; | |
331 | } | |
6b0655a2 | 332 | |
718e3744 | 333 | /* "router bgp" commands. */ |
334 | DEFUN (router_bgp, | |
335 | router_bgp_cmd, | |
320da874 | 336 | "router bgp " CMD_AS_RANGE, |
718e3744 | 337 | ROUTER_STR |
338 | BGP_STR | |
339 | AS_STR) | |
340 | { | |
341 | int ret; | |
342 | as_t as; | |
343 | struct bgp *bgp; | |
fd79ac91 | 344 | const char *name = NULL; |
718e3744 | 345 | |
0b2aa3a0 | 346 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 347 | |
348 | if (argc == 2) | |
349 | name = argv[1]; | |
350 | ||
351 | ret = bgp_get (&bgp, &as, name); | |
352 | switch (ret) | |
353 | { | |
354 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
355 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
356 | VTY_NEWLINE); | |
357 | return CMD_WARNING; | |
718e3744 | 358 | case BGP_ERR_AS_MISMATCH: |
aea339f7 | 359 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
718e3744 | 360 | return CMD_WARNING; |
718e3744 | 361 | case BGP_ERR_INSTANCE_MISMATCH: |
362 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
aea339f7 | 363 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
718e3744 | 364 | as, VTY_NEWLINE); |
365 | return CMD_WARNING; | |
718e3744 | 366 | } |
367 | ||
368 | vty->node = BGP_NODE; | |
369 | vty->index = bgp; | |
370 | ||
371 | return CMD_SUCCESS; | |
372 | } | |
373 | ||
374 | ALIAS (router_bgp, | |
375 | router_bgp_view_cmd, | |
320da874 | 376 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 377 | ROUTER_STR |
378 | BGP_STR | |
379 | AS_STR | |
380 | "BGP view\n" | |
381 | "view name\n") | |
6b0655a2 | 382 | |
718e3744 | 383 | /* "no router bgp" commands. */ |
384 | DEFUN (no_router_bgp, | |
385 | no_router_bgp_cmd, | |
320da874 | 386 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 387 | NO_STR |
388 | ROUTER_STR | |
389 | BGP_STR | |
390 | AS_STR) | |
391 | { | |
392 | as_t as; | |
393 | struct bgp *bgp; | |
fd79ac91 | 394 | const char *name = NULL; |
718e3744 | 395 | |
0b2aa3a0 | 396 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 397 | |
398 | if (argc == 2) | |
399 | name = argv[1]; | |
400 | ||
401 | /* Lookup bgp structure. */ | |
402 | bgp = bgp_lookup (as, name); | |
403 | if (! bgp) | |
404 | { | |
405 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
406 | return CMD_WARNING; | |
407 | } | |
408 | ||
409 | bgp_delete (bgp); | |
410 | ||
411 | return CMD_SUCCESS; | |
412 | } | |
413 | ||
414 | ALIAS (no_router_bgp, | |
415 | no_router_bgp_view_cmd, | |
320da874 | 416 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 417 | NO_STR |
418 | ROUTER_STR | |
419 | BGP_STR | |
420 | AS_STR | |
421 | "BGP view\n" | |
422 | "view name\n") | |
6b0655a2 | 423 | |
718e3744 | 424 | /* BGP router-id. */ |
425 | ||
426 | DEFUN (bgp_router_id, | |
427 | bgp_router_id_cmd, | |
428 | "bgp router-id A.B.C.D", | |
429 | BGP_STR | |
430 | "Override configured router identifier\n" | |
431 | "Manually configured router identifier\n") | |
432 | { | |
433 | int ret; | |
434 | struct in_addr id; | |
435 | struct bgp *bgp; | |
436 | ||
437 | bgp = vty->index; | |
438 | ||
439 | ret = inet_aton (argv[0], &id); | |
440 | if (! ret) | |
441 | { | |
442 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
443 | return CMD_WARNING; | |
444 | } | |
445 | ||
18a6dce6 | 446 | bgp->router_id_static = id; |
718e3744 | 447 | bgp_router_id_set (bgp, &id); |
448 | ||
449 | return CMD_SUCCESS; | |
450 | } | |
451 | ||
452 | DEFUN (no_bgp_router_id, | |
453 | no_bgp_router_id_cmd, | |
454 | "no bgp router-id", | |
455 | NO_STR | |
456 | BGP_STR | |
457 | "Override configured router identifier\n") | |
458 | { | |
459 | int ret; | |
460 | struct in_addr id; | |
461 | struct bgp *bgp; | |
462 | ||
463 | bgp = vty->index; | |
464 | ||
465 | if (argc == 1) | |
466 | { | |
467 | ret = inet_aton (argv[0], &id); | |
468 | if (! ret) | |
469 | { | |
470 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
471 | return CMD_WARNING; | |
472 | } | |
473 | ||
18a6dce6 | 474 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 475 | { |
476 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
477 | return CMD_WARNING; | |
478 | } | |
479 | } | |
480 | ||
18a6dce6 | 481 | bgp->router_id_static.s_addr = 0; |
482 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 483 | |
484 | return CMD_SUCCESS; | |
485 | } | |
486 | ||
487 | ALIAS (no_bgp_router_id, | |
488 | no_bgp_router_id_val_cmd, | |
489 | "no bgp router-id A.B.C.D", | |
490 | NO_STR | |
491 | BGP_STR | |
492 | "Override configured router identifier\n" | |
493 | "Manually configured router identifier\n") | |
6b0655a2 | 494 | |
718e3744 | 495 | /* BGP Cluster ID. */ |
496 | ||
497 | DEFUN (bgp_cluster_id, | |
498 | bgp_cluster_id_cmd, | |
499 | "bgp cluster-id A.B.C.D", | |
500 | BGP_STR | |
501 | "Configure Route-Reflector Cluster-id\n" | |
502 | "Route-Reflector Cluster-id in IP address format\n") | |
503 | { | |
504 | int ret; | |
505 | struct bgp *bgp; | |
506 | struct in_addr cluster; | |
507 | ||
508 | bgp = vty->index; | |
509 | ||
510 | ret = inet_aton (argv[0], &cluster); | |
511 | if (! ret) | |
512 | { | |
513 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
514 | return CMD_WARNING; | |
515 | } | |
516 | ||
517 | bgp_cluster_id_set (bgp, &cluster); | |
518 | ||
519 | return CMD_SUCCESS; | |
520 | } | |
521 | ||
522 | ALIAS (bgp_cluster_id, | |
523 | bgp_cluster_id32_cmd, | |
524 | "bgp cluster-id <1-4294967295>", | |
525 | BGP_STR | |
526 | "Configure Route-Reflector Cluster-id\n" | |
527 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
528 | ||
529 | DEFUN (no_bgp_cluster_id, | |
530 | no_bgp_cluster_id_cmd, | |
531 | "no bgp cluster-id", | |
532 | NO_STR | |
533 | BGP_STR | |
534 | "Configure Route-Reflector Cluster-id\n") | |
535 | { | |
536 | int ret; | |
537 | struct bgp *bgp; | |
538 | struct in_addr cluster; | |
539 | ||
540 | bgp = vty->index; | |
541 | ||
542 | if (argc == 1) | |
543 | { | |
544 | ret = inet_aton (argv[0], &cluster); | |
545 | if (! ret) | |
546 | { | |
547 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
548 | return CMD_WARNING; | |
549 | } | |
550 | } | |
551 | ||
552 | bgp_cluster_id_unset (bgp); | |
553 | ||
554 | return CMD_SUCCESS; | |
555 | } | |
556 | ||
557 | ALIAS (no_bgp_cluster_id, | |
558 | no_bgp_cluster_id_arg_cmd, | |
559 | "no bgp cluster-id A.B.C.D", | |
560 | NO_STR | |
561 | BGP_STR | |
562 | "Configure Route-Reflector Cluster-id\n" | |
563 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 564 | |
718e3744 | 565 | DEFUN (bgp_confederation_identifier, |
566 | bgp_confederation_identifier_cmd, | |
320da874 | 567 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 568 | "BGP specific commands\n" |
569 | "AS confederation parameters\n" | |
570 | "AS number\n" | |
571 | "Set routing domain confederation AS\n") | |
572 | { | |
573 | struct bgp *bgp; | |
574 | as_t as; | |
575 | ||
576 | bgp = vty->index; | |
577 | ||
0b2aa3a0 | 578 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 579 | |
580 | bgp_confederation_id_set (bgp, as); | |
581 | ||
582 | return CMD_SUCCESS; | |
583 | } | |
584 | ||
585 | DEFUN (no_bgp_confederation_identifier, | |
586 | no_bgp_confederation_identifier_cmd, | |
587 | "no bgp confederation identifier", | |
588 | NO_STR | |
589 | "BGP specific commands\n" | |
590 | "AS confederation parameters\n" | |
591 | "AS number\n") | |
592 | { | |
593 | struct bgp *bgp; | |
594 | as_t as; | |
595 | ||
596 | bgp = vty->index; | |
597 | ||
598 | if (argc == 1) | |
0b2aa3a0 | 599 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 600 | |
601 | bgp_confederation_id_unset (bgp); | |
602 | ||
603 | return CMD_SUCCESS; | |
604 | } | |
605 | ||
606 | ALIAS (no_bgp_confederation_identifier, | |
607 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 608 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 609 | NO_STR |
610 | "BGP specific commands\n" | |
611 | "AS confederation parameters\n" | |
612 | "AS number\n" | |
613 | "Set routing domain confederation AS\n") | |
6b0655a2 | 614 | |
718e3744 | 615 | DEFUN (bgp_confederation_peers, |
616 | bgp_confederation_peers_cmd, | |
320da874 | 617 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 618 | "BGP specific commands\n" |
619 | "AS confederation parameters\n" | |
620 | "Peer ASs in BGP confederation\n" | |
621 | AS_STR) | |
622 | { | |
623 | struct bgp *bgp; | |
624 | as_t as; | |
625 | int i; | |
626 | ||
627 | bgp = vty->index; | |
628 | ||
629 | for (i = 0; i < argc; i++) | |
630 | { | |
0b2aa3a0 | 631 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 632 | |
633 | if (bgp->as == as) | |
634 | { | |
635 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
636 | VTY_NEWLINE); | |
637 | continue; | |
638 | } | |
639 | ||
640 | bgp_confederation_peers_add (bgp, as); | |
641 | } | |
642 | return CMD_SUCCESS; | |
643 | } | |
644 | ||
645 | DEFUN (no_bgp_confederation_peers, | |
646 | no_bgp_confederation_peers_cmd, | |
320da874 | 647 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 648 | NO_STR |
649 | "BGP specific commands\n" | |
650 | "AS confederation parameters\n" | |
651 | "Peer ASs in BGP confederation\n" | |
652 | AS_STR) | |
653 | { | |
654 | struct bgp *bgp; | |
655 | as_t as; | |
656 | int i; | |
657 | ||
658 | bgp = vty->index; | |
659 | ||
660 | for (i = 0; i < argc; i++) | |
661 | { | |
0b2aa3a0 PJ |
662 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
663 | ||
718e3744 | 664 | bgp_confederation_peers_remove (bgp, as); |
665 | } | |
666 | return CMD_SUCCESS; | |
667 | } | |
6b0655a2 | 668 | |
5e242b0d DS |
669 | /** |
670 | * Central routine for maximum-paths configuration. | |
671 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
672 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
673 | */ | |
674 | int | |
675 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths, | |
676 | u_int16_t options, int set) | |
165b5fff JB |
677 | { |
678 | struct bgp *bgp; | |
679 | u_int16_t maxpaths; | |
680 | int ret; | |
5e242b0d DS |
681 | afi_t afi; |
682 | safi_t safi; | |
165b5fff JB |
683 | |
684 | bgp = vty->index; | |
5e242b0d DS |
685 | afi = bgp_node_afi (vty); |
686 | safi = bgp_node_safi (vty); | |
165b5fff | 687 | |
5e242b0d DS |
688 | if (set) |
689 | { | |
73ac8160 DS |
690 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
691 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
692 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
693 | options); | |
694 | } | |
695 | else | |
696 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 697 | |
165b5fff JB |
698 | if (ret < 0) |
699 | { | |
700 | vty_out (vty, | |
5e242b0d DS |
701 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
702 | (set == 1) ? "" : "un", | |
703 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
704 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
705 | return CMD_WARNING; |
706 | } | |
707 | ||
708 | return CMD_SUCCESS; | |
709 | } | |
710 | ||
abc920f8 DS |
711 | DEFUN (bgp_maxmed_admin, |
712 | bgp_maxmed_admin_cmd, | |
713 | "bgp max-med administrative ", | |
714 | BGP_STR | |
715 | "Advertise routes with max-med\n" | |
716 | "Administratively applied, for an indefinite period\n") | |
717 | { | |
718 | struct bgp *bgp; | |
719 | ||
720 | bgp = vty->index; | |
721 | ||
722 | bgp->v_maxmed_admin = 1; | |
723 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
724 | ||
725 | bgp_maxmed_update(bgp); | |
726 | ||
727 | return CMD_SUCCESS; | |
728 | } | |
729 | ||
730 | DEFUN (bgp_maxmed_admin_medv, | |
731 | bgp_maxmed_admin_medv_cmd, | |
732 | "bgp max-med administrative <0-4294967294>", | |
733 | BGP_STR | |
734 | "Advertise routes with max-med\n" | |
735 | "Administratively applied, for an indefinite period\n" | |
736 | "Max MED value to be used\n") | |
737 | { | |
738 | struct bgp *bgp; | |
739 | ||
740 | bgp = vty->index; | |
741 | ||
742 | bgp->v_maxmed_admin = 1; | |
743 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
744 | ||
745 | bgp_maxmed_update(bgp); | |
746 | ||
747 | return CMD_SUCCESS; | |
748 | } | |
749 | ||
750 | DEFUN (no_bgp_maxmed_admin, | |
751 | no_bgp_maxmed_admin_cmd, | |
752 | "no bgp max-med administrative", | |
753 | NO_STR | |
754 | BGP_STR | |
755 | "Advertise routes with max-med\n" | |
756 | "Administratively applied, for an indefinite period\n") | |
757 | { | |
758 | struct bgp *bgp; | |
759 | ||
760 | bgp = vty->index; | |
761 | ||
762 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
763 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
764 | ||
765 | bgp_maxmed_update(bgp); | |
766 | ||
767 | return CMD_SUCCESS; | |
768 | } | |
769 | ||
770 | ALIAS (no_bgp_maxmed_admin, | |
771 | no_bgp_maxmed_admin_medv_cmd, | |
772 | "no bgp max-med administrative <0-4294967294>", | |
773 | NO_STR | |
774 | BGP_STR | |
775 | "Advertise routes with max-med\n" | |
776 | "Administratively applied, for an indefinite period\n" | |
777 | "Max MED value to be used\n") | |
778 | ||
779 | ||
780 | DEFUN (bgp_maxmed_onstartup, | |
781 | bgp_maxmed_onstartup_cmd, | |
782 | "bgp max-med on-startup <5-86400>", | |
783 | BGP_STR | |
784 | "Advertise routes with max-med\n" | |
785 | "Effective on a startup\n" | |
786 | "Time (seconds) period for max-med\n") | |
787 | { | |
788 | struct bgp *bgp; | |
789 | ||
790 | bgp = vty->index; | |
791 | ||
792 | if (argc != 1) | |
793 | { | |
794 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
795 | return CMD_WARNING; | |
796 | } | |
797 | ||
798 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
799 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
800 | ||
801 | bgp_maxmed_update(bgp); | |
802 | ||
803 | return CMD_SUCCESS; | |
804 | } | |
805 | ||
806 | DEFUN (bgp_maxmed_onstartup_medv, | |
807 | bgp_maxmed_onstartup_medv_cmd, | |
808 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
809 | BGP_STR | |
810 | "Advertise routes with max-med\n" | |
811 | "Effective on a startup\n" | |
812 | "Time (seconds) period for max-med\n" | |
813 | "Max MED value to be used\n") | |
814 | { | |
815 | struct bgp *bgp; | |
816 | ||
817 | bgp = vty->index; | |
818 | ||
819 | if (argc != 2) | |
820 | { | |
821 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
822 | return CMD_WARNING; | |
823 | } | |
824 | ||
825 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
826 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
827 | ||
828 | bgp_maxmed_update(bgp); | |
829 | ||
830 | return CMD_SUCCESS; | |
831 | } | |
832 | ||
833 | DEFUN (no_bgp_maxmed_onstartup, | |
834 | no_bgp_maxmed_onstartup_cmd, | |
835 | "no bgp max-med on-startup", | |
836 | NO_STR | |
837 | BGP_STR | |
838 | "Advertise routes with max-med\n" | |
839 | "Effective on a startup\n") | |
840 | { | |
841 | struct bgp *bgp; | |
842 | ||
843 | bgp = vty->index; | |
844 | ||
845 | /* Cancel max-med onstartup if its on */ | |
846 | if (bgp->t_maxmed_onstartup) | |
847 | { | |
848 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
849 | bgp->maxmed_onstartup_over = 1; | |
850 | } | |
851 | ||
852 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
853 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
854 | ||
855 | bgp_maxmed_update(bgp); | |
856 | ||
857 | return CMD_SUCCESS; | |
858 | } | |
859 | ||
860 | ALIAS (no_bgp_maxmed_onstartup, | |
861 | no_bgp_maxmed_onstartup_period_cmd, | |
862 | "no bgp max-med on-startup <5-86400>", | |
863 | NO_STR | |
864 | BGP_STR | |
865 | "Advertise routes with max-med\n" | |
866 | "Effective on a startup\n" | |
867 | "Time (seconds) period for max-med\n") | |
868 | ||
869 | ALIAS (no_bgp_maxmed_onstartup, | |
870 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
871 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
872 | NO_STR | |
873 | BGP_STR | |
874 | "Advertise routes with max-med\n" | |
875 | "Effective on a startup\n" | |
876 | "Time (seconds) period for max-med\n" | |
877 | "Max MED value to be used\n") | |
878 | ||
f188f2c4 DS |
879 | static int |
880 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
881 | const char *wait) | |
882 | { | |
883 | struct bgp *bgp; | |
884 | u_int16_t update_delay; | |
885 | u_int16_t establish_wait; | |
886 | ||
887 | ||
888 | bgp = vty->index; | |
889 | ||
890 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
891 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
892 | ||
893 | if (!wait) /* update-delay <delay> */ | |
894 | { | |
895 | bgp->v_update_delay = update_delay; | |
896 | bgp->v_establish_wait = bgp->v_update_delay; | |
897 | return CMD_SUCCESS; | |
898 | } | |
899 | ||
900 | /* update-delay <delay> <establish-wait> */ | |
901 | establish_wait = atoi (wait); | |
902 | if (update_delay < establish_wait) | |
903 | { | |
904 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
905 | VTY_NEWLINE); | |
906 | return CMD_WARNING; | |
907 | } | |
908 | ||
909 | bgp->v_update_delay = update_delay; | |
910 | bgp->v_establish_wait = establish_wait; | |
911 | ||
912 | return CMD_SUCCESS; | |
913 | } | |
914 | ||
915 | static int | |
916 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
917 | { | |
918 | struct bgp *bgp; | |
919 | ||
920 | bgp = vty->index; | |
921 | ||
922 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
923 | bgp->v_establish_wait = bgp->v_update_delay; | |
924 | ||
925 | return CMD_SUCCESS; | |
926 | } | |
927 | ||
928 | int | |
929 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
930 | { | |
931 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
932 | { | |
933 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
934 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
935 | vty_out (vty, " %d", bgp->v_establish_wait); | |
936 | vty_out (vty, "%s", VTY_NEWLINE); | |
937 | } | |
938 | ||
939 | return 0; | |
940 | } | |
941 | ||
942 | ||
943 | /* Update-delay configuration */ | |
944 | DEFUN (bgp_update_delay, | |
945 | bgp_update_delay_cmd, | |
946 | "update-delay <0-3600>", | |
947 | "Force initial delay for best-path and updates\n" | |
948 | "Seconds\n") | |
949 | { | |
950 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
951 | } | |
952 | ||
953 | DEFUN (bgp_update_delay_establish_wait, | |
954 | bgp_update_delay_establish_wait_cmd, | |
955 | "update-delay <0-3600> <1-3600>", | |
956 | "Force initial delay for best-path and updates\n" | |
957 | "Seconds\n" | |
958 | "Wait for peers to be established\n" | |
959 | "Seconds\n") | |
960 | { | |
961 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
962 | } | |
963 | ||
964 | /* Update-delay deconfiguration */ | |
965 | DEFUN (no_bgp_update_delay, | |
966 | no_bgp_update_delay_cmd, | |
967 | "no update-delay <0-3600>", | |
968 | "Force initial delay for best-path and updates\n" | |
969 | "Seconds\n") | |
970 | { | |
971 | return bgp_update_delay_deconfig_vty(vty); | |
972 | } | |
973 | ||
974 | ALIAS (no_bgp_update_delay, | |
975 | no_bgp_update_delay_establish_wait_cmd, | |
976 | "no update-delay <0-3600> <1-3600>", | |
977 | "Force initial delay for best-path and updates\n" | |
978 | "Seconds\n" | |
979 | "Wait for peers to be established\n" | |
980 | "Seconds\n") | |
5e242b0d | 981 | |
cb1faec9 DS |
982 | int |
983 | bgp_wpkt_quanta_config_vty (struct vty *vty, char *num, char set) | |
984 | { | |
985 | struct bgp *bgp; | |
986 | u_int16_t update_delay; | |
987 | ||
988 | bgp = vty->index; | |
989 | ||
990 | if (set) | |
991 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
992 | 1, 4294967295); | |
993 | else | |
994 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
995 | ||
996 | return CMD_SUCCESS; | |
997 | } | |
998 | ||
999 | int | |
1000 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1001 | { | |
1002 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1003 | vty_out (vty, " write-quanta %d%s", | |
1004 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1005 | ||
1006 | return 0; | |
1007 | } | |
1008 | ||
1009 | ||
1010 | /* Update-delay configuration */ | |
1011 | DEFUN (bgp_wpkt_quanta, | |
1012 | bgp_wpkt_quanta_cmd, | |
1013 | "write-quanta <1-4294967295>", | |
1014 | "How many packets to write to peer socket per run\n" | |
1015 | "Number of packets\n") | |
1016 | { | |
1017 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1018 | } | |
1019 | ||
1020 | /* Update-delay deconfiguration */ | |
1021 | DEFUN (no_bgp_wpkt_quanta, | |
1022 | no_bgp_wpkt_quanta_cmd, | |
1023 | "no write-quanta <1-4294967295>", | |
1024 | "How many packets to write to peer socket per run\n" | |
1025 | "Number of packets\n") | |
1026 | { | |
1027 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1028 | } | |
1029 | ||
5e242b0d DS |
1030 | /* Maximum-paths configuration */ |
1031 | DEFUN (bgp_maxpaths, | |
1032 | bgp_maxpaths_cmd, | |
1033 | "maximum-paths <1-255>", | |
1034 | "Forward packets over multiple paths\n" | |
1035 | "Number of paths\n") | |
1036 | { | |
1037 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1038 | } | |
1039 | ||
165b5fff JB |
1040 | DEFUN (bgp_maxpaths_ibgp, |
1041 | bgp_maxpaths_ibgp_cmd, | |
1042 | "maximum-paths ibgp <1-255>", | |
1043 | "Forward packets over multiple paths\n" | |
1044 | "iBGP-multipath\n" | |
1045 | "Number of paths\n") | |
1046 | { | |
5e242b0d DS |
1047 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1048 | } | |
165b5fff | 1049 | |
5e242b0d DS |
1050 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1051 | bgp_maxpaths_ibgp_cluster_cmd, | |
1052 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
1053 | "Forward packets over multiple paths\n" | |
1054 | "iBGP-multipath\n" | |
1055 | "Number of paths\n" | |
1056 | "Match the cluster length\n") | |
1057 | { | |
1058 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1059 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1060 | } |
1061 | ||
1062 | DEFUN (no_bgp_maxpaths, | |
1063 | no_bgp_maxpaths_cmd, | |
1064 | "no maximum-paths", | |
1065 | NO_STR | |
1066 | "Forward packets over multiple paths\n" | |
1067 | "Number of paths\n") | |
1068 | { | |
5e242b0d | 1069 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1070 | } |
1071 | ||
1072 | ALIAS (no_bgp_maxpaths, | |
1073 | no_bgp_maxpaths_arg_cmd, | |
1074 | "no maximum-paths <1-255>", | |
1075 | NO_STR | |
1076 | "Forward packets over multiple paths\n" | |
1077 | "Number of paths\n") | |
1078 | ||
1079 | DEFUN (no_bgp_maxpaths_ibgp, | |
1080 | no_bgp_maxpaths_ibgp_cmd, | |
1081 | "no maximum-paths ibgp", | |
1082 | NO_STR | |
1083 | "Forward packets over multiple paths\n" | |
1084 | "iBGP-multipath\n" | |
1085 | "Number of paths\n") | |
1086 | { | |
5e242b0d | 1087 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1088 | } |
1089 | ||
1090 | ALIAS (no_bgp_maxpaths_ibgp, | |
1091 | no_bgp_maxpaths_ibgp_arg_cmd, | |
1092 | "no maximum-paths ibgp <1-255>", | |
1093 | NO_STR | |
1094 | "Forward packets over multiple paths\n" | |
1095 | "iBGP-multipath\n" | |
1096 | "Number of paths\n") | |
1097 | ||
5e242b0d DS |
1098 | ALIAS (no_bgp_maxpaths_ibgp, |
1099 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
1100 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
1101 | NO_STR | |
1102 | "Forward packets over multiple paths\n" | |
1103 | "iBGP-multipath\n" | |
1104 | "Number of paths\n" | |
1105 | "Match the cluster length\n") | |
1106 | ||
165b5fff JB |
1107 | int |
1108 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1109 | safi_t safi, int *write) | |
1110 | { | |
1111 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
1112 | { | |
1113 | bgp_config_write_family_header (vty, afi, safi, write); | |
1114 | vty_out (vty, " maximum-paths %d%s", | |
1115 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); | |
1116 | } | |
1117 | ||
1118 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
1119 | { | |
1120 | bgp_config_write_family_header (vty, afi, safi, write); | |
5e242b0d DS |
1121 | vty_out (vty, " maximum-paths ibgp %d", |
1122 | bgp->maxpaths[afi][safi].maxpaths_ibgp); | |
1123 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1124 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1125 | vty_out (vty, " equal-cluster-length"); | |
1126 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1127 | } |
1128 | ||
1129 | return 0; | |
1130 | } | |
6b0655a2 | 1131 | |
718e3744 | 1132 | /* BGP timers. */ |
1133 | ||
1134 | DEFUN (bgp_timers, | |
1135 | bgp_timers_cmd, | |
1136 | "timers bgp <0-65535> <0-65535>", | |
1137 | "Adjust routing timers\n" | |
1138 | "BGP timers\n" | |
1139 | "Keepalive interval\n" | |
1140 | "Holdtime\n") | |
1141 | { | |
1142 | struct bgp *bgp; | |
1143 | unsigned long keepalive = 0; | |
1144 | unsigned long holdtime = 0; | |
1145 | ||
1146 | bgp = vty->index; | |
1147 | ||
1148 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1149 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1150 | ||
1151 | /* Holdtime value check. */ | |
1152 | if (holdtime < 3 && holdtime != 0) | |
1153 | { | |
1154 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1155 | VTY_NEWLINE); | |
1156 | return CMD_WARNING; | |
1157 | } | |
1158 | ||
1159 | bgp_timers_set (bgp, keepalive, holdtime); | |
1160 | ||
1161 | return CMD_SUCCESS; | |
1162 | } | |
1163 | ||
1164 | DEFUN (no_bgp_timers, | |
1165 | no_bgp_timers_cmd, | |
1166 | "no timers bgp", | |
1167 | NO_STR | |
1168 | "Adjust routing timers\n" | |
1169 | "BGP timers\n") | |
1170 | { | |
1171 | struct bgp *bgp; | |
1172 | ||
1173 | bgp = vty->index; | |
1174 | bgp_timers_unset (bgp); | |
1175 | ||
1176 | return CMD_SUCCESS; | |
1177 | } | |
1178 | ||
1179 | ALIAS (no_bgp_timers, | |
1180 | no_bgp_timers_arg_cmd, | |
1181 | "no timers bgp <0-65535> <0-65535>", | |
1182 | NO_STR | |
1183 | "Adjust routing timers\n" | |
1184 | "BGP timers\n" | |
1185 | "Keepalive interval\n" | |
1186 | "Holdtime\n") | |
6b0655a2 | 1187 | |
718e3744 | 1188 | DEFUN (bgp_client_to_client_reflection, |
1189 | bgp_client_to_client_reflection_cmd, | |
1190 | "bgp client-to-client reflection", | |
1191 | "BGP specific commands\n" | |
1192 | "Configure client to client route reflection\n" | |
1193 | "reflection of routes allowed\n") | |
1194 | { | |
1195 | struct bgp *bgp; | |
1196 | ||
1197 | bgp = vty->index; | |
1198 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
1199 | return CMD_SUCCESS; | |
1200 | } | |
1201 | ||
1202 | DEFUN (no_bgp_client_to_client_reflection, | |
1203 | no_bgp_client_to_client_reflection_cmd, | |
1204 | "no bgp client-to-client reflection", | |
1205 | NO_STR | |
1206 | "BGP specific commands\n" | |
1207 | "Configure client to client route reflection\n" | |
1208 | "reflection of routes allowed\n") | |
1209 | { | |
1210 | struct bgp *bgp; | |
1211 | ||
1212 | bgp = vty->index; | |
1213 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
1214 | return CMD_SUCCESS; | |
1215 | } | |
1216 | ||
1217 | /* "bgp always-compare-med" configuration. */ | |
1218 | DEFUN (bgp_always_compare_med, | |
1219 | bgp_always_compare_med_cmd, | |
1220 | "bgp always-compare-med", | |
1221 | "BGP specific commands\n" | |
1222 | "Allow comparing MED from different neighbors\n") | |
1223 | { | |
1224 | struct bgp *bgp; | |
1225 | ||
1226 | bgp = vty->index; | |
1227 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
1228 | return CMD_SUCCESS; | |
1229 | } | |
1230 | ||
1231 | DEFUN (no_bgp_always_compare_med, | |
1232 | no_bgp_always_compare_med_cmd, | |
1233 | "no bgp always-compare-med", | |
1234 | NO_STR | |
1235 | "BGP specific commands\n" | |
1236 | "Allow comparing MED from different neighbors\n") | |
1237 | { | |
1238 | struct bgp *bgp; | |
1239 | ||
1240 | bgp = vty->index; | |
1241 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
1242 | return CMD_SUCCESS; | |
1243 | } | |
6b0655a2 | 1244 | |
718e3744 | 1245 | /* "bgp deterministic-med" configuration. */ |
1246 | DEFUN (bgp_deterministic_med, | |
1247 | bgp_deterministic_med_cmd, | |
1248 | "bgp deterministic-med", | |
1249 | "BGP specific commands\n" | |
1250 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1251 | { | |
1252 | struct bgp *bgp; | |
1253 | ||
1254 | bgp = vty->index; | |
1255 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1256 | return CMD_SUCCESS; | |
1257 | } | |
1258 | ||
1259 | DEFUN (no_bgp_deterministic_med, | |
1260 | no_bgp_deterministic_med_cmd, | |
1261 | "no bgp deterministic-med", | |
1262 | NO_STR | |
1263 | "BGP specific commands\n" | |
1264 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1265 | { | |
1266 | struct bgp *bgp; | |
1267 | ||
1268 | bgp = vty->index; | |
1269 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1270 | return CMD_SUCCESS; | |
1271 | } | |
538621f2 | 1272 | |
1273 | /* "bgp graceful-restart" configuration. */ | |
1274 | DEFUN (bgp_graceful_restart, | |
1275 | bgp_graceful_restart_cmd, | |
1276 | "bgp graceful-restart", | |
1277 | "BGP specific commands\n" | |
1278 | "Graceful restart capability parameters\n") | |
1279 | { | |
1280 | struct bgp *bgp; | |
1281 | ||
1282 | bgp = vty->index; | |
1283 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1284 | return CMD_SUCCESS; | |
1285 | } | |
1286 | ||
1287 | DEFUN (no_bgp_graceful_restart, | |
1288 | no_bgp_graceful_restart_cmd, | |
1289 | "no bgp graceful-restart", | |
1290 | NO_STR | |
1291 | "BGP specific commands\n" | |
1292 | "Graceful restart capability parameters\n") | |
1293 | { | |
1294 | struct bgp *bgp; | |
1295 | ||
1296 | bgp = vty->index; | |
1297 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1298 | return CMD_SUCCESS; | |
1299 | } | |
1300 | ||
93406d87 | 1301 | DEFUN (bgp_graceful_restart_stalepath_time, |
1302 | bgp_graceful_restart_stalepath_time_cmd, | |
1303 | "bgp graceful-restart stalepath-time <1-3600>", | |
1304 | "BGP specific commands\n" | |
1305 | "Graceful restart capability parameters\n" | |
1306 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1307 | "Delay value (seconds)\n") | |
1308 | { | |
1309 | struct bgp *bgp; | |
1310 | u_int32_t stalepath; | |
1311 | ||
1312 | bgp = vty->index; | |
1313 | if (! bgp) | |
1314 | return CMD_WARNING; | |
1315 | ||
1316 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1317 | bgp->stalepath_time = stalepath; | |
1318 | return CMD_SUCCESS; | |
1319 | } | |
1320 | ||
1321 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1322 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1323 | "no bgp graceful-restart stalepath-time", | |
1324 | NO_STR | |
1325 | "BGP specific commands\n" | |
1326 | "Graceful restart capability parameters\n" | |
1327 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1328 | { | |
1329 | struct bgp *bgp; | |
1330 | ||
1331 | bgp = vty->index; | |
1332 | if (! bgp) | |
1333 | return CMD_WARNING; | |
1334 | ||
1335 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1336 | return CMD_SUCCESS; | |
1337 | } | |
1338 | ||
1339 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1340 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1341 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1342 | NO_STR | |
1343 | "BGP specific commands\n" | |
1344 | "Graceful restart capability parameters\n" | |
1345 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1346 | "Delay value (seconds)\n") | |
1347 | ||
718e3744 | 1348 | /* "bgp fast-external-failover" configuration. */ |
1349 | DEFUN (bgp_fast_external_failover, | |
1350 | bgp_fast_external_failover_cmd, | |
1351 | "bgp fast-external-failover", | |
1352 | BGP_STR | |
1353 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1354 | { | |
1355 | struct bgp *bgp; | |
1356 | ||
1357 | bgp = vty->index; | |
1358 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1359 | return CMD_SUCCESS; | |
1360 | } | |
1361 | ||
1362 | DEFUN (no_bgp_fast_external_failover, | |
1363 | no_bgp_fast_external_failover_cmd, | |
1364 | "no bgp fast-external-failover", | |
1365 | NO_STR | |
1366 | BGP_STR | |
1367 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1368 | { | |
1369 | struct bgp *bgp; | |
1370 | ||
1371 | bgp = vty->index; | |
1372 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1373 | return CMD_SUCCESS; | |
1374 | } | |
6b0655a2 | 1375 | |
718e3744 | 1376 | /* "bgp enforce-first-as" configuration. */ |
1377 | DEFUN (bgp_enforce_first_as, | |
1378 | bgp_enforce_first_as_cmd, | |
1379 | "bgp enforce-first-as", | |
1380 | BGP_STR | |
1381 | "Enforce the first AS for EBGP routes\n") | |
1382 | { | |
1383 | struct bgp *bgp; | |
1384 | ||
1385 | bgp = vty->index; | |
1386 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1387 | return CMD_SUCCESS; | |
1388 | } | |
1389 | ||
1390 | DEFUN (no_bgp_enforce_first_as, | |
1391 | no_bgp_enforce_first_as_cmd, | |
1392 | "no bgp enforce-first-as", | |
1393 | NO_STR | |
1394 | BGP_STR | |
1395 | "Enforce the first AS for EBGP routes\n") | |
1396 | { | |
1397 | struct bgp *bgp; | |
1398 | ||
1399 | bgp = vty->index; | |
1400 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1401 | return CMD_SUCCESS; | |
1402 | } | |
6b0655a2 | 1403 | |
718e3744 | 1404 | /* "bgp bestpath compare-routerid" configuration. */ |
1405 | DEFUN (bgp_bestpath_compare_router_id, | |
1406 | bgp_bestpath_compare_router_id_cmd, | |
1407 | "bgp bestpath compare-routerid", | |
1408 | "BGP specific commands\n" | |
1409 | "Change the default bestpath selection\n" | |
1410 | "Compare router-id for identical EBGP paths\n") | |
1411 | { | |
1412 | struct bgp *bgp; | |
1413 | ||
1414 | bgp = vty->index; | |
1415 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1416 | return CMD_SUCCESS; | |
1417 | } | |
1418 | ||
1419 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1420 | no_bgp_bestpath_compare_router_id_cmd, | |
1421 | "no bgp bestpath compare-routerid", | |
1422 | NO_STR | |
1423 | "BGP specific commands\n" | |
1424 | "Change the default bestpath selection\n" | |
1425 | "Compare router-id for identical EBGP paths\n") | |
1426 | { | |
1427 | struct bgp *bgp; | |
1428 | ||
1429 | bgp = vty->index; | |
1430 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1431 | return CMD_SUCCESS; | |
1432 | } | |
6b0655a2 | 1433 | |
718e3744 | 1434 | /* "bgp bestpath as-path ignore" configuration. */ |
1435 | DEFUN (bgp_bestpath_aspath_ignore, | |
1436 | bgp_bestpath_aspath_ignore_cmd, | |
1437 | "bgp bestpath as-path ignore", | |
1438 | "BGP specific commands\n" | |
1439 | "Change the default bestpath selection\n" | |
1440 | "AS-path attribute\n" | |
1441 | "Ignore as-path length in selecting a route\n") | |
1442 | { | |
1443 | struct bgp *bgp; | |
1444 | ||
1445 | bgp = vty->index; | |
1446 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1447 | return CMD_SUCCESS; | |
1448 | } | |
1449 | ||
1450 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1451 | no_bgp_bestpath_aspath_ignore_cmd, | |
1452 | "no bgp bestpath as-path ignore", | |
1453 | NO_STR | |
1454 | "BGP specific commands\n" | |
1455 | "Change the default bestpath selection\n" | |
1456 | "AS-path attribute\n" | |
1457 | "Ignore as-path length in selecting a route\n") | |
1458 | { | |
1459 | struct bgp *bgp; | |
1460 | ||
1461 | bgp = vty->index; | |
1462 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1463 | return CMD_SUCCESS; | |
1464 | } | |
6b0655a2 | 1465 | |
6811845b | 1466 | /* "bgp bestpath as-path confed" configuration. */ |
1467 | DEFUN (bgp_bestpath_aspath_confed, | |
1468 | bgp_bestpath_aspath_confed_cmd, | |
1469 | "bgp bestpath as-path confed", | |
1470 | "BGP specific commands\n" | |
1471 | "Change the default bestpath selection\n" | |
1472 | "AS-path attribute\n" | |
1473 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1474 | { | |
1475 | struct bgp *bgp; | |
1476 | ||
1477 | bgp = vty->index; | |
1478 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
1479 | return CMD_SUCCESS; | |
1480 | } | |
1481 | ||
1482 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1483 | no_bgp_bestpath_aspath_confed_cmd, | |
1484 | "no bgp bestpath as-path confed", | |
1485 | NO_STR | |
1486 | "BGP specific commands\n" | |
1487 | "Change the default bestpath selection\n" | |
1488 | "AS-path attribute\n" | |
1489 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1490 | { | |
1491 | struct bgp *bgp; | |
1492 | ||
1493 | bgp = vty->index; | |
1494 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
1495 | return CMD_SUCCESS; | |
1496 | } | |
6b0655a2 | 1497 | |
2fdd455c PM |
1498 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1499 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1500 | bgp_bestpath_aspath_multipath_relax_cmd, | |
1501 | "bgp bestpath as-path multipath-relax", | |
1502 | "BGP specific commands\n" | |
1503 | "Change the default bestpath selection\n" | |
1504 | "AS-path attribute\n" | |
1505 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1506 | { | |
1507 | struct bgp *bgp; | |
1508 | ||
1509 | bgp = vty->index; | |
1510 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1511 | return CMD_SUCCESS; | |
1512 | } | |
1513 | ||
1514 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, | |
1515 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1516 | "no bgp bestpath as-path multipath-relax", | |
1517 | NO_STR | |
1518 | "BGP specific commands\n" | |
1519 | "Change the default bestpath selection\n" | |
1520 | "AS-path attribute\n" | |
1521 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1522 | { | |
1523 | struct bgp *bgp; | |
1524 | ||
1525 | bgp = vty->index; | |
1526 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1527 | return CMD_SUCCESS; | |
1528 | } | |
6b0655a2 | 1529 | |
848973c7 | 1530 | /* "bgp log-neighbor-changes" configuration. */ |
1531 | DEFUN (bgp_log_neighbor_changes, | |
1532 | bgp_log_neighbor_changes_cmd, | |
1533 | "bgp log-neighbor-changes", | |
1534 | "BGP specific commands\n" | |
1535 | "Log neighbor up/down and reset reason\n") | |
1536 | { | |
1537 | struct bgp *bgp; | |
1538 | ||
1539 | bgp = vty->index; | |
1540 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1541 | return CMD_SUCCESS; | |
1542 | } | |
1543 | ||
1544 | DEFUN (no_bgp_log_neighbor_changes, | |
1545 | no_bgp_log_neighbor_changes_cmd, | |
1546 | "no bgp log-neighbor-changes", | |
1547 | NO_STR | |
1548 | "BGP specific commands\n" | |
1549 | "Log neighbor up/down and reset reason\n") | |
1550 | { | |
1551 | struct bgp *bgp; | |
1552 | ||
1553 | bgp = vty->index; | |
1554 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1555 | return CMD_SUCCESS; | |
1556 | } | |
6b0655a2 | 1557 | |
718e3744 | 1558 | /* "bgp bestpath med" configuration. */ |
1559 | DEFUN (bgp_bestpath_med, | |
1560 | bgp_bestpath_med_cmd, | |
1561 | "bgp bestpath med (confed|missing-as-worst)", | |
1562 | "BGP specific commands\n" | |
1563 | "Change the default bestpath selection\n" | |
1564 | "MED attribute\n" | |
1565 | "Compare MED among confederation paths\n" | |
1566 | "Treat missing MED as the least preferred one\n") | |
1567 | { | |
1568 | struct bgp *bgp; | |
1569 | ||
1570 | bgp = vty->index; | |
1571 | ||
1572 | if (strncmp (argv[0], "confed", 1) == 0) | |
1573 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1574 | else | |
1575 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1576 | ||
1577 | return CMD_SUCCESS; | |
1578 | } | |
1579 | ||
1580 | DEFUN (bgp_bestpath_med2, | |
1581 | bgp_bestpath_med2_cmd, | |
1582 | "bgp bestpath med confed missing-as-worst", | |
1583 | "BGP specific commands\n" | |
1584 | "Change the default bestpath selection\n" | |
1585 | "MED attribute\n" | |
1586 | "Compare MED among confederation paths\n" | |
1587 | "Treat missing MED as the least preferred one\n") | |
1588 | { | |
1589 | struct bgp *bgp; | |
1590 | ||
1591 | bgp = vty->index; | |
1592 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1593 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1594 | return CMD_SUCCESS; | |
1595 | } | |
1596 | ||
1597 | ALIAS (bgp_bestpath_med2, | |
1598 | bgp_bestpath_med3_cmd, | |
1599 | "bgp bestpath med missing-as-worst confed", | |
1600 | "BGP specific commands\n" | |
1601 | "Change the default bestpath selection\n" | |
1602 | "MED attribute\n" | |
1603 | "Treat missing MED as the least preferred one\n" | |
1604 | "Compare MED among confederation paths\n") | |
1605 | ||
1606 | DEFUN (no_bgp_bestpath_med, | |
1607 | no_bgp_bestpath_med_cmd, | |
1608 | "no bgp bestpath med (confed|missing-as-worst)", | |
1609 | NO_STR | |
1610 | "BGP specific commands\n" | |
1611 | "Change the default bestpath selection\n" | |
1612 | "MED attribute\n" | |
1613 | "Compare MED among confederation paths\n" | |
1614 | "Treat missing MED as the least preferred one\n") | |
1615 | { | |
1616 | struct bgp *bgp; | |
1617 | ||
1618 | bgp = vty->index; | |
1619 | ||
1620 | if (strncmp (argv[0], "confed", 1) == 0) | |
1621 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1622 | else | |
1623 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1624 | ||
1625 | return CMD_SUCCESS; | |
1626 | } | |
1627 | ||
1628 | DEFUN (no_bgp_bestpath_med2, | |
1629 | no_bgp_bestpath_med2_cmd, | |
1630 | "no bgp bestpath med confed missing-as-worst", | |
1631 | NO_STR | |
1632 | "BGP specific commands\n" | |
1633 | "Change the default bestpath selection\n" | |
1634 | "MED attribute\n" | |
1635 | "Compare MED among confederation paths\n" | |
1636 | "Treat missing MED as the least preferred one\n") | |
1637 | { | |
1638 | struct bgp *bgp; | |
1639 | ||
1640 | bgp = vty->index; | |
1641 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1642 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1643 | return CMD_SUCCESS; | |
1644 | } | |
1645 | ||
1646 | ALIAS (no_bgp_bestpath_med2, | |
1647 | no_bgp_bestpath_med3_cmd, | |
1648 | "no bgp bestpath med missing-as-worst confed", | |
1649 | NO_STR | |
1650 | "BGP specific commands\n" | |
1651 | "Change the default bestpath selection\n" | |
1652 | "MED attribute\n" | |
1653 | "Treat missing MED as the least preferred one\n" | |
1654 | "Compare MED among confederation paths\n") | |
6b0655a2 | 1655 | |
718e3744 | 1656 | /* "no bgp default ipv4-unicast". */ |
1657 | DEFUN (no_bgp_default_ipv4_unicast, | |
1658 | no_bgp_default_ipv4_unicast_cmd, | |
1659 | "no bgp default ipv4-unicast", | |
1660 | NO_STR | |
1661 | "BGP specific commands\n" | |
1662 | "Configure BGP defaults\n" | |
1663 | "Activate ipv4-unicast for a peer by default\n") | |
1664 | { | |
1665 | struct bgp *bgp; | |
1666 | ||
1667 | bgp = vty->index; | |
1668 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1669 | return CMD_SUCCESS; | |
1670 | } | |
1671 | ||
1672 | DEFUN (bgp_default_ipv4_unicast, | |
1673 | bgp_default_ipv4_unicast_cmd, | |
1674 | "bgp default ipv4-unicast", | |
1675 | "BGP specific commands\n" | |
1676 | "Configure BGP defaults\n" | |
1677 | "Activate ipv4-unicast for a peer by default\n") | |
1678 | { | |
1679 | struct bgp *bgp; | |
1680 | ||
1681 | bgp = vty->index; | |
1682 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1683 | return CMD_SUCCESS; | |
1684 | } | |
6b0655a2 | 1685 | |
718e3744 | 1686 | /* "bgp import-check" configuration. */ |
1687 | DEFUN (bgp_network_import_check, | |
1688 | bgp_network_import_check_cmd, | |
1689 | "bgp network import-check", | |
1690 | "BGP specific commands\n" | |
1691 | "BGP network command\n" | |
1692 | "Check BGP network route exists in IGP\n") | |
1693 | { | |
1694 | struct bgp *bgp; | |
1695 | ||
1696 | bgp = vty->index; | |
1697 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
1698 | return CMD_SUCCESS; | |
1699 | } | |
1700 | ||
1701 | DEFUN (no_bgp_network_import_check, | |
1702 | no_bgp_network_import_check_cmd, | |
1703 | "no bgp network import-check", | |
1704 | NO_STR | |
1705 | "BGP specific commands\n" | |
1706 | "BGP network command\n" | |
1707 | "Check BGP network route exists in IGP\n") | |
1708 | { | |
1709 | struct bgp *bgp; | |
1710 | ||
1711 | bgp = vty->index; | |
1712 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
1713 | return CMD_SUCCESS; | |
1714 | } | |
6b0655a2 | 1715 | |
718e3744 | 1716 | DEFUN (bgp_default_local_preference, |
1717 | bgp_default_local_preference_cmd, | |
1718 | "bgp default local-preference <0-4294967295>", | |
1719 | "BGP specific commands\n" | |
1720 | "Configure BGP defaults\n" | |
1721 | "local preference (higher=more preferred)\n" | |
1722 | "Configure default local preference value\n") | |
1723 | { | |
1724 | struct bgp *bgp; | |
1725 | u_int32_t local_pref; | |
1726 | ||
1727 | bgp = vty->index; | |
1728 | ||
1729 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
1730 | ||
1731 | bgp_default_local_preference_set (bgp, local_pref); | |
1732 | ||
1733 | return CMD_SUCCESS; | |
1734 | } | |
1735 | ||
1736 | DEFUN (no_bgp_default_local_preference, | |
1737 | no_bgp_default_local_preference_cmd, | |
1738 | "no bgp default local-preference", | |
1739 | NO_STR | |
1740 | "BGP specific commands\n" | |
1741 | "Configure BGP defaults\n" | |
1742 | "local preference (higher=more preferred)\n") | |
1743 | { | |
1744 | struct bgp *bgp; | |
1745 | ||
1746 | bgp = vty->index; | |
1747 | bgp_default_local_preference_unset (bgp); | |
1748 | return CMD_SUCCESS; | |
1749 | } | |
1750 | ||
1751 | ALIAS (no_bgp_default_local_preference, | |
1752 | no_bgp_default_local_preference_val_cmd, | |
1753 | "no bgp default local-preference <0-4294967295>", | |
1754 | NO_STR | |
1755 | "BGP specific commands\n" | |
1756 | "Configure BGP defaults\n" | |
1757 | "local preference (higher=more preferred)\n" | |
1758 | "Configure default local preference value\n") | |
6b0655a2 | 1759 | |
8bd9d948 DS |
1760 | static void |
1761 | peer_announce_routes_if_rmap_out (struct bgp *bgp) | |
1762 | { | |
1763 | struct peer *peer; | |
1764 | struct listnode *node, *nnode; | |
1765 | struct bgp_filter *filter; | |
1766 | afi_t afi; | |
1767 | safi_t safi; | |
1768 | ||
1769 | /* Reannounce all routes to appropriate neighbors */ | |
1770 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
1771 | { | |
1772 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
1773 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
1774 | { | |
1775 | if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
1776 | { | |
1777 | /* check if there's an out route-map on this client */ | |
1778 | filter = &peer->filter[afi][safi]; | |
1779 | if (ROUTE_MAP_OUT_NAME(filter)) | |
1780 | { | |
16286195 | 1781 | if (bgp_debug_update(peer, NULL, 0)) |
8bd9d948 DS |
1782 | zlog_debug("%s: Announcing routes again for peer %s" |
1783 | "(afi=%d, safi=%d", __func__, peer->host, afi, | |
1784 | safi); | |
1785 | ||
1786 | bgp_announce_route_all(peer); | |
1787 | } | |
1788 | } | |
1789 | } | |
1790 | } | |
1791 | } | |
1792 | ||
1793 | DEFUN (bgp_rr_allow_outbound_policy, | |
1794 | bgp_rr_allow_outbound_policy_cmd, | |
1795 | "bgp route-reflector allow-outbound-policy", | |
1796 | "BGP specific commands\n" | |
1797 | "Allow modifications made by out route-map\n" | |
1798 | "on ibgp neighbors\n") | |
1799 | { | |
1800 | struct bgp *bgp; | |
1801 | u_int32_t local_pref; | |
1802 | int ret; | |
1803 | ||
1804 | bgp = vty->index; | |
1805 | ||
1806 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
1807 | { | |
1808 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
1809 | peer_announce_routes_if_rmap_out(bgp); | |
1810 | } | |
1811 | ||
1812 | return CMD_SUCCESS; | |
1813 | } | |
1814 | ||
1815 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
1816 | no_bgp_rr_allow_outbound_policy_cmd, | |
1817 | "no bgp route-reflector allow-outbound-policy", | |
1818 | NO_STR | |
1819 | "BGP specific commands\n" | |
1820 | "Allow modifications made by out route-map\n" | |
1821 | "on ibgp neighbors\n") | |
1822 | { | |
1823 | struct bgp *bgp; | |
1824 | u_int32_t local_pref; | |
1825 | ||
1826 | bgp = vty->index; | |
1827 | ||
1828 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
1829 | { | |
1830 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
1831 | peer_announce_routes_if_rmap_out(bgp); | |
1832 | } | |
1833 | ||
1834 | return CMD_SUCCESS; | |
1835 | } | |
1836 | ||
718e3744 | 1837 | static int |
fd79ac91 | 1838 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
1839 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 1840 | { |
1841 | int ret; | |
1842 | struct bgp *bgp; | |
1843 | as_t as; | |
1844 | union sockunion su; | |
1845 | ||
1846 | bgp = vty->index; | |
1847 | ||
1848 | /* Get AS number. */ | |
0b2aa3a0 | 1849 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
718e3744 | 1850 | |
1851 | /* If peer is peer group, call proper function. */ | |
1852 | ret = str2sockunion (peer_str, &su); | |
1853 | if (ret < 0) | |
1854 | { | |
a80beece DS |
1855 | /* Check for peer by interface */ |
1856 | ret = peer_remote_as (bgp, NULL, peer_str, &as, afi, safi); | |
718e3744 | 1857 | if (ret < 0) |
a80beece DS |
1858 | { |
1859 | ret = peer_group_remote_as (bgp, peer_str, &as); | |
1860 | if (ret < 0) | |
1861 | { | |
1862 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
1863 | VTY_NEWLINE); | |
1864 | return CMD_WARNING; | |
1865 | } | |
1866 | return CMD_SUCCESS; | |
1867 | } | |
718e3744 | 1868 | } |
a80beece | 1869 | else |
718e3744 | 1870 | { |
a80beece DS |
1871 | if (peer_address_self_check (&su)) |
1872 | { | |
1873 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1874 | VTY_NEWLINE); | |
1875 | return CMD_WARNING; | |
1876 | } | |
1877 | ret = peer_remote_as (bgp, &su, NULL, &as, afi, safi); | |
718e3744 | 1878 | } |
1879 | ||
718e3744 | 1880 | /* This peer belongs to peer group. */ |
1881 | switch (ret) | |
1882 | { | |
1883 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 1884 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 1885 | return CMD_WARNING; |
718e3744 | 1886 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 1887 | vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); |
718e3744 | 1888 | return CMD_WARNING; |
718e3744 | 1889 | } |
1890 | return bgp_vty_return (vty, ret); | |
1891 | } | |
1892 | ||
1893 | DEFUN (neighbor_remote_as, | |
1894 | neighbor_remote_as_cmd, | |
320da874 | 1895 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
718e3744 | 1896 | NEIGHBOR_STR |
1897 | NEIGHBOR_ADDR_STR2 | |
1898 | "Specify a BGP neighbor\n" | |
1899 | AS_STR) | |
1900 | { | |
1901 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
1902 | } | |
6b0655a2 | 1903 | |
a80beece DS |
1904 | DEFUN (neighbor_interface_config, |
1905 | neighbor_interface_config_cmd, | |
1906 | "neighbor WORD interface", | |
1907 | NEIGHBOR_STR | |
1908 | "Interface name or neighbor tag\n" | |
1909 | "Enable BGP on interface\n") | |
1910 | { | |
1911 | struct bgp *bgp; | |
1912 | struct peer *peer; | |
1913 | struct peer_group *group; | |
1914 | ||
1915 | bgp = vty->index; | |
1916 | group = peer_group_lookup (bgp, argv[0]); | |
1917 | if (group) | |
1918 | { | |
1919 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
1920 | return CMD_WARNING; | |
1921 | } | |
1922 | ||
1923 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST); | |
1924 | if (!peer) | |
1925 | return CMD_WARNING; | |
1926 | ||
1927 | return CMD_SUCCESS; | |
1928 | } | |
1929 | ||
1930 | ||
718e3744 | 1931 | DEFUN (neighbor_peer_group, |
1932 | neighbor_peer_group_cmd, | |
1933 | "neighbor WORD peer-group", | |
1934 | NEIGHBOR_STR | |
a80beece | 1935 | "Interface name or neighbor tag\n" |
718e3744 | 1936 | "Configure peer-group\n") |
1937 | { | |
1938 | struct bgp *bgp; | |
a80beece | 1939 | struct peer *peer; |
718e3744 | 1940 | struct peer_group *group; |
1941 | ||
1942 | bgp = vty->index; | |
a80beece DS |
1943 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
1944 | if (peer) | |
1945 | { | |
1946 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
1947 | return CMD_WARNING; | |
1948 | } | |
718e3744 | 1949 | |
1950 | group = peer_group_get (bgp, argv[0]); | |
1951 | if (! group) | |
1952 | return CMD_WARNING; | |
1953 | ||
1954 | return CMD_SUCCESS; | |
1955 | } | |
1956 | ||
1957 | DEFUN (no_neighbor, | |
1958 | no_neighbor_cmd, | |
1959 | NO_NEIGHBOR_CMD2, | |
1960 | NO_STR | |
1961 | NEIGHBOR_STR | |
1962 | NEIGHBOR_ADDR_STR2) | |
1963 | { | |
1964 | int ret; | |
1965 | union sockunion su; | |
1966 | struct peer_group *group; | |
1967 | struct peer *peer; | |
1ff9a340 | 1968 | struct peer *other; |
718e3744 | 1969 | |
1970 | ret = str2sockunion (argv[0], &su); | |
1971 | if (ret < 0) | |
1972 | { | |
a80beece DS |
1973 | /* look up for neighbor by interface name config. */ |
1974 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
1975 | if (peer) | |
1976 | { | |
1977 | peer_delete (peer); | |
1978 | return CMD_SUCCESS; | |
1979 | } | |
1980 | ||
718e3744 | 1981 | group = peer_group_lookup (vty->index, argv[0]); |
1982 | if (group) | |
1983 | peer_group_delete (group); | |
1984 | else | |
1985 | { | |
1986 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1987 | return CMD_WARNING; | |
1988 | } | |
1989 | } | |
1990 | else | |
1991 | { | |
1992 | peer = peer_lookup (vty->index, &su); | |
1993 | if (peer) | |
1ff9a340 DS |
1994 | { |
1995 | other = peer->doppelganger; | |
1996 | peer_delete (peer); | |
1997 | if (other && other->status != Deleted) | |
1998 | peer_delete(other); | |
1999 | } | |
718e3744 | 2000 | } |
2001 | ||
2002 | return CMD_SUCCESS; | |
2003 | } | |
2004 | ||
2005 | ALIAS (no_neighbor, | |
2006 | no_neighbor_remote_as_cmd, | |
320da874 | 2007 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
718e3744 | 2008 | NO_STR |
2009 | NEIGHBOR_STR | |
2010 | NEIGHBOR_ADDR_STR | |
2011 | "Specify a BGP neighbor\n" | |
2012 | AS_STR) | |
2013 | ||
a80beece DS |
2014 | DEFUN (no_neighbor_interface_config, |
2015 | no_neighbor_interface_config_cmd, | |
2016 | "no neighbor WORD interface", | |
2017 | NO_STR | |
2018 | NEIGHBOR_STR | |
2019 | "Interface name\n" | |
2020 | "Configure BGP on interface\n") | |
2021 | { | |
2022 | struct peer *peer; | |
2023 | ||
2024 | /* look up for neighbor by interface name config. */ | |
2025 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2026 | if (peer) | |
2027 | { | |
2028 | peer_delete (peer); | |
2029 | } | |
2030 | else | |
2031 | { | |
2032 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
2033 | return CMD_WARNING; | |
2034 | } | |
2035 | return CMD_SUCCESS; | |
2036 | } | |
2037 | ||
718e3744 | 2038 | DEFUN (no_neighbor_peer_group, |
2039 | no_neighbor_peer_group_cmd, | |
2040 | "no neighbor WORD peer-group", | |
2041 | NO_STR | |
2042 | NEIGHBOR_STR | |
2043 | "Neighbor tag\n" | |
2044 | "Configure peer-group\n") | |
2045 | { | |
2046 | struct peer_group *group; | |
2047 | ||
2048 | group = peer_group_lookup (vty->index, argv[0]); | |
2049 | if (group) | |
2050 | peer_group_delete (group); | |
2051 | else | |
2052 | { | |
2053 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2054 | return CMD_WARNING; | |
2055 | } | |
2056 | return CMD_SUCCESS; | |
2057 | } | |
2058 | ||
a80beece DS |
2059 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
2060 | no_neighbor_interface_peer_group_remote_as_cmd, | |
320da874 | 2061 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
718e3744 | 2062 | NO_STR |
2063 | NEIGHBOR_STR | |
a80beece | 2064 | "Interface name or neighbor tag\n" |
718e3744 | 2065 | "Specify a BGP neighbor\n" |
2066 | AS_STR) | |
2067 | { | |
2068 | struct peer_group *group; | |
a80beece DS |
2069 | struct peer *peer; |
2070 | ||
2071 | /* look up for neighbor by interface name config. */ | |
2072 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2073 | if (peer) | |
2074 | { | |
2075 | peer_as_change (peer, 0); | |
2076 | return CMD_SUCCESS; | |
2077 | } | |
718e3744 | 2078 | |
2079 | group = peer_group_lookup (vty->index, argv[0]); | |
2080 | if (group) | |
2081 | peer_group_remote_as_delete (group); | |
2082 | else | |
2083 | { | |
a80beece | 2084 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 2085 | return CMD_WARNING; |
2086 | } | |
2087 | return CMD_SUCCESS; | |
2088 | } | |
6b0655a2 | 2089 | |
718e3744 | 2090 | DEFUN (neighbor_local_as, |
2091 | neighbor_local_as_cmd, | |
320da874 | 2092 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2093 | NEIGHBOR_STR |
2094 | NEIGHBOR_ADDR_STR2 | |
2095 | "Specify a local-as number\n" | |
2096 | "AS number used as local AS\n") | |
2097 | { | |
2098 | struct peer *peer; | |
2099 | int ret; | |
2100 | ||
2101 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2102 | if (! peer) | |
2103 | return CMD_WARNING; | |
2104 | ||
9d3f9705 | 2105 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 2106 | return bgp_vty_return (vty, ret); |
2107 | } | |
2108 | ||
2109 | DEFUN (neighbor_local_as_no_prepend, | |
2110 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 2111 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2112 | NEIGHBOR_STR |
2113 | NEIGHBOR_ADDR_STR2 | |
2114 | "Specify a local-as number\n" | |
2115 | "AS number used as local AS\n" | |
2116 | "Do not prepend local-as to updates from ebgp peers\n") | |
2117 | { | |
2118 | struct peer *peer; | |
2119 | int ret; | |
2120 | ||
2121 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2122 | if (! peer) | |
2123 | return CMD_WARNING; | |
2124 | ||
9d3f9705 | 2125 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 2126 | return bgp_vty_return (vty, ret); |
2127 | } | |
2128 | ||
9d3f9705 AC |
2129 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
2130 | neighbor_local_as_no_prepend_replace_as_cmd, | |
2131 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2132 | NEIGHBOR_STR | |
2133 | NEIGHBOR_ADDR_STR2 | |
2134 | "Specify a local-as number\n" | |
2135 | "AS number used as local AS\n" | |
2136 | "Do not prepend local-as to updates from ebgp peers\n" | |
2137 | "Do not prepend local-as to updates from ibgp peers\n") | |
2138 | { | |
2139 | struct peer *peer; | |
2140 | int ret; | |
2141 | ||
2142 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2143 | if (! peer) | |
2144 | return CMD_WARNING; | |
2145 | ||
2146 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
2147 | return bgp_vty_return (vty, ret); | |
2148 | } | |
2149 | ||
2150 | ||
718e3744 | 2151 | DEFUN (no_neighbor_local_as, |
2152 | no_neighbor_local_as_cmd, | |
2153 | NO_NEIGHBOR_CMD2 "local-as", | |
2154 | NO_STR | |
2155 | NEIGHBOR_STR | |
2156 | NEIGHBOR_ADDR_STR2 | |
2157 | "Specify a local-as number\n") | |
2158 | { | |
2159 | struct peer *peer; | |
2160 | int ret; | |
2161 | ||
2162 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2163 | if (! peer) | |
2164 | return CMD_WARNING; | |
2165 | ||
2166 | ret = peer_local_as_unset (peer); | |
2167 | return bgp_vty_return (vty, ret); | |
2168 | } | |
2169 | ||
2170 | ALIAS (no_neighbor_local_as, | |
2171 | no_neighbor_local_as_val_cmd, | |
320da874 | 2172 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2173 | NO_STR |
2174 | NEIGHBOR_STR | |
2175 | NEIGHBOR_ADDR_STR2 | |
2176 | "Specify a local-as number\n" | |
2177 | "AS number used as local AS\n") | |
2178 | ||
2179 | ALIAS (no_neighbor_local_as, | |
2180 | no_neighbor_local_as_val2_cmd, | |
320da874 | 2181 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2182 | NO_STR |
2183 | NEIGHBOR_STR | |
2184 | NEIGHBOR_ADDR_STR2 | |
2185 | "Specify a local-as number\n" | |
2186 | "AS number used as local AS\n" | |
2187 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
2188 | |
2189 | ALIAS (no_neighbor_local_as, | |
2190 | no_neighbor_local_as_val3_cmd, | |
2191 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2192 | NO_STR | |
2193 | NEIGHBOR_STR | |
2194 | NEIGHBOR_ADDR_STR2 | |
2195 | "Specify a local-as number\n" | |
2196 | "AS number used as local AS\n" | |
2197 | "Do not prepend local-as to updates from ebgp peers\n" | |
2198 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 2199 | |
0df7c91f PJ |
2200 | DEFUN (neighbor_password, |
2201 | neighbor_password_cmd, | |
2202 | NEIGHBOR_CMD2 "password LINE", | |
2203 | NEIGHBOR_STR | |
2204 | NEIGHBOR_ADDR_STR2 | |
2205 | "Set a password\n" | |
2206 | "The password\n") | |
2207 | { | |
2208 | struct peer *peer; | |
2209 | int ret; | |
2210 | ||
2211 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2212 | if (! peer) | |
2213 | return CMD_WARNING; | |
2214 | ||
2215 | ret = peer_password_set (peer, argv[1]); | |
2216 | return bgp_vty_return (vty, ret); | |
2217 | } | |
2218 | ||
2219 | DEFUN (no_neighbor_password, | |
2220 | no_neighbor_password_cmd, | |
2221 | NO_NEIGHBOR_CMD2 "password", | |
2222 | NO_STR | |
2223 | NEIGHBOR_STR | |
2224 | NEIGHBOR_ADDR_STR2 | |
2225 | "Set a password\n") | |
2226 | { | |
2227 | struct peer *peer; | |
2228 | int ret; | |
2229 | ||
2230 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2231 | if (! peer) | |
2232 | return CMD_WARNING; | |
2233 | ||
2234 | ret = peer_password_unset (peer); | |
2235 | return bgp_vty_return (vty, ret); | |
2236 | } | |
6b0655a2 | 2237 | |
718e3744 | 2238 | DEFUN (neighbor_activate, |
2239 | neighbor_activate_cmd, | |
2240 | NEIGHBOR_CMD2 "activate", | |
2241 | NEIGHBOR_STR | |
2242 | NEIGHBOR_ADDR_STR2 | |
2243 | "Enable the Address Family for this Neighbor\n") | |
2244 | { | |
2245 | struct peer *peer; | |
2246 | ||
2247 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2248 | if (! peer) | |
2249 | return CMD_WARNING; | |
2250 | ||
2251 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2252 | ||
2253 | return CMD_SUCCESS; | |
2254 | } | |
2255 | ||
2256 | DEFUN (no_neighbor_activate, | |
2257 | no_neighbor_activate_cmd, | |
2258 | NO_NEIGHBOR_CMD2 "activate", | |
2259 | NO_STR | |
2260 | NEIGHBOR_STR | |
2261 | NEIGHBOR_ADDR_STR2 | |
2262 | "Enable the Address Family for this Neighbor\n") | |
2263 | { | |
2264 | int ret; | |
2265 | struct peer *peer; | |
2266 | ||
2267 | /* Lookup peer. */ | |
2268 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2269 | if (! peer) | |
2270 | return CMD_WARNING; | |
2271 | ||
2272 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2273 | ||
2274 | return bgp_vty_return (vty, ret); | |
2275 | } | |
6b0655a2 | 2276 | |
718e3744 | 2277 | DEFUN (neighbor_set_peer_group, |
2278 | neighbor_set_peer_group_cmd, | |
a80beece | 2279 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 2280 | NEIGHBOR_STR |
a80beece | 2281 | NEIGHBOR_ADDR_STR2 |
718e3744 | 2282 | "Member of the peer-group\n" |
2283 | "peer-group name\n") | |
2284 | { | |
2285 | int ret; | |
2286 | as_t as; | |
2287 | union sockunion su; | |
2288 | struct bgp *bgp; | |
a80beece | 2289 | struct peer *peer; |
718e3744 | 2290 | struct peer_group *group; |
2291 | ||
2292 | bgp = vty->index; | |
a80beece | 2293 | peer = NULL; |
718e3744 | 2294 | |
2295 | ret = str2sockunion (argv[0], &su); | |
2296 | if (ret < 0) | |
2297 | { | |
a80beece DS |
2298 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2299 | if (!peer) | |
2300 | { | |
2301 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
2302 | return CMD_WARNING; | |
2303 | } | |
2304 | } | |
2305 | else | |
2306 | { | |
2307 | if (peer_address_self_check (&su)) | |
2308 | { | |
2309 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2310 | VTY_NEWLINE); | |
2311 | return CMD_WARNING; | |
2312 | } | |
718e3744 | 2313 | } |
2314 | ||
2315 | group = peer_group_lookup (bgp, argv[1]); | |
2316 | if (! group) | |
2317 | { | |
2318 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2319 | return CMD_WARNING; | |
2320 | } | |
2321 | ||
a80beece | 2322 | ret = peer_group_bind (bgp, &su, peer, group, bgp_node_afi (vty), |
718e3744 | 2323 | bgp_node_safi (vty), &as); |
2324 | ||
2325 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
2326 | { | |
aea339f7 | 2327 | vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE); |
718e3744 | 2328 | return CMD_WARNING; |
2329 | } | |
2330 | ||
2331 | return bgp_vty_return (vty, ret); | |
2332 | } | |
2333 | ||
2334 | DEFUN (no_neighbor_set_peer_group, | |
2335 | no_neighbor_set_peer_group_cmd, | |
a80beece | 2336 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 2337 | NO_STR |
2338 | NEIGHBOR_STR | |
a80beece | 2339 | NEIGHBOR_ADDR_STR2 |
718e3744 | 2340 | "Member of the peer-group\n" |
2341 | "peer-group name\n") | |
2342 | { | |
2343 | int ret; | |
2344 | struct bgp *bgp; | |
2345 | struct peer *peer; | |
2346 | struct peer_group *group; | |
2347 | ||
2348 | bgp = vty->index; | |
2349 | ||
2350 | peer = peer_lookup_vty (vty, argv[0]); | |
2351 | if (! peer) | |
2352 | return CMD_WARNING; | |
2353 | ||
2354 | group = peer_group_lookup (bgp, argv[1]); | |
2355 | if (! group) | |
2356 | { | |
2357 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2358 | return CMD_WARNING; | |
2359 | } | |
2360 | ||
2361 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
2362 | bgp_node_safi (vty)); | |
2363 | ||
2364 | return bgp_vty_return (vty, ret); | |
2365 | } | |
6b0655a2 | 2366 | |
94f2b392 | 2367 | static int |
fd79ac91 | 2368 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
2369 | u_int16_t flag, int set) | |
718e3744 | 2370 | { |
2371 | int ret; | |
2372 | struct peer *peer; | |
2373 | ||
2374 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2375 | if (! peer) | |
2376 | return CMD_WARNING; | |
2377 | ||
2378 | if (set) | |
2379 | ret = peer_flag_set (peer, flag); | |
2380 | else | |
2381 | ret = peer_flag_unset (peer, flag); | |
2382 | ||
2383 | return bgp_vty_return (vty, ret); | |
2384 | } | |
2385 | ||
94f2b392 | 2386 | static int |
fd79ac91 | 2387 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 2388 | { |
2389 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
2390 | } | |
2391 | ||
94f2b392 | 2392 | static int |
fd79ac91 | 2393 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 2394 | { |
2395 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
2396 | } | |
2397 | ||
2398 | /* neighbor passive. */ | |
2399 | DEFUN (neighbor_passive, | |
2400 | neighbor_passive_cmd, | |
2401 | NEIGHBOR_CMD2 "passive", | |
2402 | NEIGHBOR_STR | |
2403 | NEIGHBOR_ADDR_STR2 | |
2404 | "Don't send open messages to this neighbor\n") | |
2405 | { | |
2406 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2407 | } | |
2408 | ||
2409 | DEFUN (no_neighbor_passive, | |
2410 | no_neighbor_passive_cmd, | |
2411 | NO_NEIGHBOR_CMD2 "passive", | |
2412 | NO_STR | |
2413 | NEIGHBOR_STR | |
2414 | NEIGHBOR_ADDR_STR2 | |
2415 | "Don't send open messages to this neighbor\n") | |
2416 | { | |
2417 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2418 | } | |
6b0655a2 | 2419 | |
718e3744 | 2420 | /* neighbor shutdown. */ |
2421 | DEFUN (neighbor_shutdown, | |
2422 | neighbor_shutdown_cmd, | |
2423 | NEIGHBOR_CMD2 "shutdown", | |
2424 | NEIGHBOR_STR | |
2425 | NEIGHBOR_ADDR_STR2 | |
2426 | "Administratively shut down this neighbor\n") | |
2427 | { | |
2428 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2429 | } | |
2430 | ||
2431 | DEFUN (no_neighbor_shutdown, | |
2432 | no_neighbor_shutdown_cmd, | |
2433 | NO_NEIGHBOR_CMD2 "shutdown", | |
2434 | NO_STR | |
2435 | NEIGHBOR_STR | |
2436 | NEIGHBOR_ADDR_STR2 | |
2437 | "Administratively shut down this neighbor\n") | |
2438 | { | |
2439 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2440 | } | |
6b0655a2 | 2441 | |
d5a5c8f0 DS |
2442 | /* neighbor bfd. */ |
2443 | DEFUN (neighbor_bfd, | |
2444 | neighbor_bfd_cmd, | |
2445 | NEIGHBOR_CMD2 "bfd", | |
2446 | NEIGHBOR_STR | |
2447 | NEIGHBOR_ADDR_STR2 | |
2448 | "Respond to BFD session event\n") | |
2449 | { | |
2450 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_BFD); | |
2451 | } | |
2452 | ||
2453 | DEFUN (no_neighbor_bfd, | |
2454 | no_neighbor_bfd_cmd, | |
2455 | NO_NEIGHBOR_CMD2 "bfd", | |
2456 | NO_STR | |
2457 | NEIGHBOR_STR | |
2458 | NEIGHBOR_ADDR_STR2 | |
2459 | "Respond to BFD session event\n") | |
2460 | { | |
2461 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_BFD); | |
2462 | } | |
2463 | ||
c9502438 | 2464 | /* Deprecated neighbor capability route-refresh. */ |
2465 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
2466 | neighbor_capability_route_refresh_cmd, | |
2467 | NEIGHBOR_CMD2 "capability route-refresh", | |
2468 | NEIGHBOR_STR | |
2469 | NEIGHBOR_ADDR_STR2 | |
2470 | "Advertise capability to the peer\n" | |
2471 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2472 | { |
c9502438 | 2473 | return CMD_SUCCESS; |
718e3744 | 2474 | } |
2475 | ||
c9502438 | 2476 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
2477 | no_neighbor_capability_route_refresh_cmd, | |
2478 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
2479 | NO_STR | |
2480 | NEIGHBOR_STR | |
2481 | NEIGHBOR_ADDR_STR2 | |
2482 | "Advertise capability to the peer\n" | |
2483 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2484 | { |
c9502438 | 2485 | return CMD_SUCCESS; |
718e3744 | 2486 | } |
6b0655a2 | 2487 | |
718e3744 | 2488 | /* neighbor capability dynamic. */ |
2489 | DEFUN (neighbor_capability_dynamic, | |
2490 | neighbor_capability_dynamic_cmd, | |
2491 | NEIGHBOR_CMD2 "capability dynamic", | |
2492 | NEIGHBOR_STR | |
2493 | NEIGHBOR_ADDR_STR2 | |
2494 | "Advertise capability to the peer\n" | |
2495 | "Advertise dynamic capability to this neighbor\n") | |
2496 | { | |
2497 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2498 | } | |
2499 | ||
2500 | DEFUN (no_neighbor_capability_dynamic, | |
2501 | no_neighbor_capability_dynamic_cmd, | |
2502 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
2503 | NO_STR | |
2504 | NEIGHBOR_STR | |
2505 | NEIGHBOR_ADDR_STR2 | |
2506 | "Advertise capability to the peer\n" | |
2507 | "Advertise dynamic capability to this neighbor\n") | |
2508 | { | |
2509 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2510 | } | |
6b0655a2 | 2511 | |
718e3744 | 2512 | /* neighbor dont-capability-negotiate */ |
2513 | DEFUN (neighbor_dont_capability_negotiate, | |
2514 | neighbor_dont_capability_negotiate_cmd, | |
2515 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2516 | NEIGHBOR_STR | |
2517 | NEIGHBOR_ADDR_STR2 | |
2518 | "Do not perform capability negotiation\n") | |
2519 | { | |
2520 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2521 | } | |
2522 | ||
2523 | DEFUN (no_neighbor_dont_capability_negotiate, | |
2524 | no_neighbor_dont_capability_negotiate_cmd, | |
2525 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2526 | NO_STR | |
2527 | NEIGHBOR_STR | |
2528 | NEIGHBOR_ADDR_STR2 | |
2529 | "Do not perform capability negotiation\n") | |
2530 | { | |
2531 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2532 | } | |
6b0655a2 | 2533 | |
94f2b392 | 2534 | static int |
fd79ac91 | 2535 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2536 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 2537 | { |
2538 | int ret; | |
2539 | struct peer *peer; | |
2540 | ||
2541 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2542 | if (! peer) | |
2543 | return CMD_WARNING; | |
2544 | ||
2545 | if (set) | |
2546 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
2547 | else | |
2548 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
2549 | ||
2550 | return bgp_vty_return (vty, ret); | |
2551 | } | |
2552 | ||
94f2b392 | 2553 | static int |
fd79ac91 | 2554 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2555 | safi_t safi, u_int32_t flag) |
718e3744 | 2556 | { |
2557 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
2558 | } | |
2559 | ||
94f2b392 | 2560 | static int |
fd79ac91 | 2561 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2562 | safi_t safi, u_int32_t flag) |
718e3744 | 2563 | { |
2564 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
2565 | } | |
6b0655a2 | 2566 | |
718e3744 | 2567 | /* neighbor capability orf prefix-list. */ |
2568 | DEFUN (neighbor_capability_orf_prefix, | |
2569 | neighbor_capability_orf_prefix_cmd, | |
2570 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2571 | NEIGHBOR_STR | |
2572 | NEIGHBOR_ADDR_STR2 | |
2573 | "Advertise capability to the peer\n" | |
2574 | "Advertise ORF capability to the peer\n" | |
2575 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2576 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2577 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2578 | "Capability to SEND the ORF to this neighbor\n") | |
2579 | { | |
2580 | u_int16_t flag = 0; | |
2581 | ||
2582 | if (strncmp (argv[1], "s", 1) == 0) | |
2583 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2584 | else if (strncmp (argv[1], "r", 1) == 0) | |
2585 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2586 | else if (strncmp (argv[1], "b", 1) == 0) | |
2587 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2588 | else | |
2589 | return CMD_WARNING; | |
2590 | ||
2591 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2592 | bgp_node_safi (vty), flag); | |
2593 | } | |
2594 | ||
2595 | DEFUN (no_neighbor_capability_orf_prefix, | |
2596 | no_neighbor_capability_orf_prefix_cmd, | |
2597 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2598 | NO_STR | |
2599 | NEIGHBOR_STR | |
2600 | NEIGHBOR_ADDR_STR2 | |
2601 | "Advertise capability to the peer\n" | |
2602 | "Advertise ORF capability to the peer\n" | |
2603 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2604 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2605 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2606 | "Capability to SEND the ORF to this neighbor\n") | |
2607 | { | |
2608 | u_int16_t flag = 0; | |
2609 | ||
2610 | if (strncmp (argv[1], "s", 1) == 0) | |
2611 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2612 | else if (strncmp (argv[1], "r", 1) == 0) | |
2613 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2614 | else if (strncmp (argv[1], "b", 1) == 0) | |
2615 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2616 | else | |
2617 | return CMD_WARNING; | |
2618 | ||
2619 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2620 | bgp_node_safi (vty), flag); | |
2621 | } | |
6b0655a2 | 2622 | |
718e3744 | 2623 | /* neighbor next-hop-self. */ |
2624 | DEFUN (neighbor_nexthop_self, | |
2625 | neighbor_nexthop_self_cmd, | |
9e7a53c1 | 2626 | NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 2627 | NEIGHBOR_STR |
2628 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
2629 | "Disable the next hop calculation for this neighbor\n" |
2630 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 2631 | { |
9e7a53c1 TT |
2632 | u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0; |
2633 | int rc; | |
2634 | ||
2635 | /* Check if "all" is specified */ | |
2636 | if (argv[1] != NULL) | |
2637 | flags |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
2638 | else | |
2639 | unset |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
2640 | ||
2641 | rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2642 | bgp_node_safi (vty), flags); | |
2643 | if ( rc == CMD_SUCCESS && unset ) | |
2644 | rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2645 | bgp_node_safi (vty), unset); | |
2646 | return rc; | |
718e3744 | 2647 | } |
2648 | ||
2649 | DEFUN (no_neighbor_nexthop_self, | |
2650 | no_neighbor_nexthop_self_cmd, | |
9e7a53c1 | 2651 | NO_NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 2652 | NO_STR |
2653 | NEIGHBOR_STR | |
2654 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
2655 | "Disable the next hop calculation for this neighbor\n" |
2656 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 2657 | { |
2658 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 TT |
2659 | bgp_node_safi (vty), |
2660 | PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL); | |
718e3744 | 2661 | } |
6b0655a2 | 2662 | |
c7122e14 DS |
2663 | /* neighbor as-override */ |
2664 | DEFUN (neighbor_as_override, | |
2665 | neighbor_as_override_cmd, | |
2666 | NEIGHBOR_CMD2 "as-override", | |
2667 | NEIGHBOR_STR | |
2668 | NEIGHBOR_ADDR_STR2 | |
2669 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
2670 | { | |
2671 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2672 | bgp_node_safi (vty), | |
2673 | PEER_FLAG_AS_OVERRIDE); | |
2674 | } | |
2675 | ||
2676 | DEFUN (no_neighbor_as_override, | |
2677 | no_neighbor_as_override_cmd, | |
2678 | NO_NEIGHBOR_CMD2 "as-override", | |
2679 | NO_STR | |
2680 | NEIGHBOR_STR | |
2681 | NEIGHBOR_ADDR_STR2 | |
2682 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
2683 | { | |
2684 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2685 | bgp_node_safi (vty), | |
2686 | PEER_FLAG_AS_OVERRIDE); | |
2687 | } | |
2688 | ||
718e3744 | 2689 | /* neighbor remove-private-AS. */ |
2690 | DEFUN (neighbor_remove_private_as, | |
2691 | neighbor_remove_private_as_cmd, | |
2692 | NEIGHBOR_CMD2 "remove-private-AS", | |
2693 | NEIGHBOR_STR | |
2694 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 2695 | "Remove private ASNs in outbound updates\n") |
718e3744 | 2696 | { |
5000f21c DS |
2697 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
2698 | bgp_node_safi (vty), | |
2699 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
2700 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 2701 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
2702 | bgp_node_safi (vty), | |
2703 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
2704 | } | |
2705 | ||
5000f21c DS |
2706 | DEFUN (neighbor_remove_private_as_all, |
2707 | neighbor_remove_private_as_all_cmd, | |
2708 | NEIGHBOR_CMD2 "remove-private-AS all", | |
2709 | NEIGHBOR_STR | |
2710 | NEIGHBOR_ADDR_STR2 | |
2711 | "Remove private ASNs in outbound updates\n" | |
2712 | "Apply to all AS numbers") | |
2713 | { | |
2714 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2715 | bgp_node_safi (vty), | |
2716 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
2717 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2718 | bgp_node_safi (vty), | |
2719 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
2720 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
2721 | } | |
2722 | ||
2723 | DEFUN (neighbor_remove_private_as_replace_as, | |
2724 | neighbor_remove_private_as_replace_as_cmd, | |
2725 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
2726 | NEIGHBOR_STR | |
2727 | NEIGHBOR_ADDR_STR2 | |
2728 | "Remove private ASNs in outbound updates\n" | |
2729 | "Replace private ASNs with our ASN in outbound updates\n") | |
2730 | { | |
2731 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2732 | bgp_node_safi (vty), | |
2733 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
2734 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2735 | bgp_node_safi (vty), | |
2736 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
2737 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
2738 | } | |
2739 | ||
2740 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
2741 | neighbor_remove_private_as_all_replace_as_cmd, | |
2742 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
2743 | NEIGHBOR_STR | |
2744 | NEIGHBOR_ADDR_STR2 | |
2745 | "Remove private ASNs in outbound updates\n" | |
2746 | "Apply to all AS numbers" | |
2747 | "Replace private ASNs with our ASN in outbound updates\n") | |
2748 | { | |
2749 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2750 | bgp_node_safi (vty), | |
2751 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
2752 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
2753 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
2754 | } | |
2755 | ||
718e3744 | 2756 | DEFUN (no_neighbor_remove_private_as, |
2757 | no_neighbor_remove_private_as_cmd, | |
2758 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
2759 | NO_STR | |
2760 | NEIGHBOR_STR | |
2761 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 2762 | "Remove private ASNs in outbound updates\n") |
718e3744 | 2763 | { |
2764 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2765 | bgp_node_safi (vty), | |
5000f21c DS |
2766 | PEER_FLAG_REMOVE_PRIVATE_AS| |
2767 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
2768 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 2769 | } |
6b0655a2 | 2770 | |
5000f21c DS |
2771 | ALIAS (no_neighbor_remove_private_as, |
2772 | no_neighbor_remove_private_as_all_cmd, | |
2773 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
2774 | NO_STR | |
2775 | NEIGHBOR_STR | |
2776 | NEIGHBOR_ADDR_STR2 | |
2777 | "Remove private ASNs in outbound updates\n" | |
2778 | "Apply to all AS numbers") | |
2779 | ||
2780 | ALIAS (no_neighbor_remove_private_as, | |
2781 | no_neighbor_remove_private_as_replace_as_cmd, | |
2782 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
2783 | NO_STR | |
2784 | NEIGHBOR_STR | |
2785 | NEIGHBOR_ADDR_STR2 | |
2786 | "Remove private ASNs in outbound updates\n" | |
2787 | "Replace private ASNs with our ASN in outbound updates\n") | |
2788 | ||
2789 | ALIAS (no_neighbor_remove_private_as, | |
2790 | no_neighbor_remove_private_as_all_replace_as_cmd, | |
2791 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
2792 | NO_STR | |
2793 | NEIGHBOR_STR | |
2794 | NEIGHBOR_ADDR_STR2 | |
2795 | "Remove private ASNs in outbound updates\n" | |
2796 | "Apply to all AS numbers" | |
2797 | "Replace private ASNs with our ASN in outbound updates\n") | |
2798 | ||
2799 | ||
718e3744 | 2800 | /* neighbor send-community. */ |
2801 | DEFUN (neighbor_send_community, | |
2802 | neighbor_send_community_cmd, | |
2803 | NEIGHBOR_CMD2 "send-community", | |
2804 | NEIGHBOR_STR | |
2805 | NEIGHBOR_ADDR_STR2 | |
2806 | "Send Community attribute to this neighbor\n") | |
2807 | { | |
2808 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2809 | bgp_node_safi (vty), | |
2810 | PEER_FLAG_SEND_COMMUNITY); | |
2811 | } | |
2812 | ||
2813 | DEFUN (no_neighbor_send_community, | |
2814 | no_neighbor_send_community_cmd, | |
2815 | NO_NEIGHBOR_CMD2 "send-community", | |
2816 | NO_STR | |
2817 | NEIGHBOR_STR | |
2818 | NEIGHBOR_ADDR_STR2 | |
2819 | "Send Community attribute to this neighbor\n") | |
2820 | { | |
2821 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2822 | bgp_node_safi (vty), | |
2823 | PEER_FLAG_SEND_COMMUNITY); | |
2824 | } | |
6b0655a2 | 2825 | |
718e3744 | 2826 | /* neighbor send-community extended. */ |
2827 | DEFUN (neighbor_send_community_type, | |
2828 | neighbor_send_community_type_cmd, | |
2829 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
2830 | NEIGHBOR_STR | |
2831 | NEIGHBOR_ADDR_STR2 | |
2832 | "Send Community attribute to this neighbor\n" | |
2833 | "Send Standard and Extended Community attributes\n" | |
2834 | "Send Extended Community attributes\n" | |
2835 | "Send Standard Community attributes\n") | |
2836 | { | |
2837 | if (strncmp (argv[1], "s", 1) == 0) | |
2838 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2839 | bgp_node_safi (vty), | |
2840 | PEER_FLAG_SEND_COMMUNITY); | |
2841 | if (strncmp (argv[1], "e", 1) == 0) | |
2842 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2843 | bgp_node_safi (vty), | |
2844 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
2845 | ||
2846 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2847 | bgp_node_safi (vty), | |
2848 | (PEER_FLAG_SEND_COMMUNITY| | |
2849 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
2850 | } | |
2851 | ||
2852 | DEFUN (no_neighbor_send_community_type, | |
2853 | no_neighbor_send_community_type_cmd, | |
2854 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
2855 | NO_STR | |
2856 | NEIGHBOR_STR | |
2857 | NEIGHBOR_ADDR_STR2 | |
2858 | "Send Community attribute to this neighbor\n" | |
2859 | "Send Standard and Extended Community attributes\n" | |
2860 | "Send Extended Community attributes\n" | |
2861 | "Send Standard Community attributes\n") | |
2862 | { | |
2863 | if (strncmp (argv[1], "s", 1) == 0) | |
2864 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2865 | bgp_node_safi (vty), | |
2866 | PEER_FLAG_SEND_COMMUNITY); | |
2867 | if (strncmp (argv[1], "e", 1) == 0) | |
2868 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2869 | bgp_node_safi (vty), | |
2870 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
2871 | ||
2872 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2873 | bgp_node_safi (vty), | |
2874 | (PEER_FLAG_SEND_COMMUNITY | | |
2875 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
2876 | } | |
6b0655a2 | 2877 | |
718e3744 | 2878 | /* neighbor soft-reconfig. */ |
2879 | DEFUN (neighbor_soft_reconfiguration, | |
2880 | neighbor_soft_reconfiguration_cmd, | |
2881 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2882 | NEIGHBOR_STR | |
2883 | NEIGHBOR_ADDR_STR2 | |
2884 | "Per neighbor soft reconfiguration\n" | |
2885 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2886 | { | |
2887 | return peer_af_flag_set_vty (vty, argv[0], | |
2888 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2889 | PEER_FLAG_SOFT_RECONFIG); | |
2890 | } | |
2891 | ||
2892 | DEFUN (no_neighbor_soft_reconfiguration, | |
2893 | no_neighbor_soft_reconfiguration_cmd, | |
2894 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2895 | NO_STR | |
2896 | NEIGHBOR_STR | |
2897 | NEIGHBOR_ADDR_STR2 | |
2898 | "Per neighbor soft reconfiguration\n" | |
2899 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2900 | { | |
2901 | return peer_af_flag_unset_vty (vty, argv[0], | |
2902 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2903 | PEER_FLAG_SOFT_RECONFIG); | |
2904 | } | |
6b0655a2 | 2905 | |
718e3744 | 2906 | DEFUN (neighbor_route_reflector_client, |
2907 | neighbor_route_reflector_client_cmd, | |
2908 | NEIGHBOR_CMD2 "route-reflector-client", | |
2909 | NEIGHBOR_STR | |
2910 | NEIGHBOR_ADDR_STR2 | |
2911 | "Configure a neighbor as Route Reflector client\n") | |
2912 | { | |
2913 | struct peer *peer; | |
2914 | ||
2915 | ||
2916 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2917 | if (! peer) | |
2918 | return CMD_WARNING; | |
2919 | ||
2920 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2921 | bgp_node_safi (vty), | |
2922 | PEER_FLAG_REFLECTOR_CLIENT); | |
2923 | } | |
2924 | ||
2925 | DEFUN (no_neighbor_route_reflector_client, | |
2926 | no_neighbor_route_reflector_client_cmd, | |
2927 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
2928 | NO_STR | |
2929 | NEIGHBOR_STR | |
2930 | NEIGHBOR_ADDR_STR2 | |
2931 | "Configure a neighbor as Route Reflector client\n") | |
2932 | { | |
2933 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2934 | bgp_node_safi (vty), | |
2935 | PEER_FLAG_REFLECTOR_CLIENT); | |
2936 | } | |
6b0655a2 | 2937 | |
94f2b392 | 2938 | static int |
fd79ac91 | 2939 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
2940 | int afi, int safi) | |
fee0f4c6 | 2941 | { |
2942 | int ret; | |
2943 | struct bgp *bgp; | |
2944 | struct peer *peer; | |
2945 | struct peer_group *group; | |
1eb8ef25 | 2946 | struct listnode *node, *nnode; |
fee0f4c6 | 2947 | struct bgp_filter *pfilter; |
2948 | struct bgp_filter *gfilter; | |
228da428 | 2949 | int locked_and_added = 0; |
fee0f4c6 | 2950 | |
2951 | bgp = vty->index; | |
2952 | ||
2953 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2954 | if ( ! peer ) | |
2955 | return CMD_WARNING; | |
2956 | ||
2957 | /* If it is already a RS-Client, don't do anything. */ | |
2958 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2959 | return CMD_SUCCESS; | |
2960 | ||
2961 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 2962 | { |
2963 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
2964 | listnode_add_sort (bgp->rsclient, peer); | |
228da428 | 2965 | locked_and_added = 1; |
200df115 | 2966 | } |
fee0f4c6 | 2967 | |
2968 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2969 | if (ret < 0) | |
228da428 CC |
2970 | { |
2971 | if (locked_and_added) | |
2972 | { | |
2973 | listnode_delete (bgp->rsclient, peer); | |
2974 | peer_unlock (peer); /* rsclient peer list reference */ | |
2975 | } | |
2976 | ||
2977 | return bgp_vty_return (vty, ret); | |
2978 | } | |
fee0f4c6 | 2979 | |
64e580a7 | 2980 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 2981 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
228da428 CC |
2982 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
2983 | peer->rib[afi][safi]->owner = peer_lock (peer); | |
fee0f4c6 | 2984 | |
2985 | /* Check for existing 'network' and 'redistribute' routes. */ | |
2986 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
2987 | ||
2988 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
2989 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
2990 | ||
2991 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2992 | { | |
2993 | group = peer->group; | |
2994 | gfilter = &peer->filter[afi][safi]; | |
2995 | ||
1eb8ef25 | 2996 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 2997 | { |
2998 | pfilter = &peer->filter[afi][safi]; | |
2999 | ||
3000 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
3001 | is checked when the become part of the peer-group */ | |
3002 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3003 | if (ret < 0) | |
3004 | return bgp_vty_return (vty, ret); | |
3005 | ||
3006 | /* Make peer's RIB point to group's RIB. */ | |
3007 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
3008 | ||
3009 | /* Import policy. */ | |
3010 | if (pfilter->map[RMAP_IMPORT].name) | |
3011 | free (pfilter->map[RMAP_IMPORT].name); | |
3012 | if (gfilter->map[RMAP_IMPORT].name) | |
3013 | { | |
3014 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); | |
3015 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; | |
3016 | } | |
3017 | else | |
3018 | { | |
3019 | pfilter->map[RMAP_IMPORT].name = NULL; | |
3020 | pfilter->map[RMAP_IMPORT].map =NULL; | |
3021 | } | |
3022 | ||
3023 | /* Export policy. */ | |
3024 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
3025 | { | |
3026 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); | |
3027 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; | |
3028 | } | |
3029 | } | |
3030 | } | |
3031 | return CMD_SUCCESS; | |
3032 | } | |
3033 | ||
94f2b392 | 3034 | static int |
fd79ac91 | 3035 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
3036 | int afi, int safi) | |
fee0f4c6 | 3037 | { |
3038 | int ret; | |
3039 | struct bgp *bgp; | |
3040 | struct peer *peer; | |
3041 | struct peer_group *group; | |
1eb8ef25 | 3042 | struct listnode *node, *nnode; |
fee0f4c6 | 3043 | |
3044 | bgp = vty->index; | |
3045 | ||
3046 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3047 | if ( ! peer ) | |
3048 | return CMD_WARNING; | |
3049 | ||
3050 | /* If it is not a RS-Client, don't do anything. */ | |
3051 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3052 | return CMD_SUCCESS; | |
3053 | ||
3054 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3055 | { | |
3056 | group = peer->group; | |
3057 | ||
1eb8ef25 | 3058 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3059 | { |
3060 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3061 | if (ret < 0) | |
3062 | return bgp_vty_return (vty, ret); | |
3063 | ||
3064 | peer->rib[afi][safi] = NULL; | |
3065 | } | |
3066 | ||
3067 | peer = group->conf; | |
3068 | } | |
3069 | ||
3070 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3071 | if (ret < 0) | |
3072 | return bgp_vty_return (vty, ret); | |
3073 | ||
3074 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3075 | { |
228da428 | 3076 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
200df115 | 3077 | listnode_delete (bgp->rsclient, peer); |
228da428 | 3078 | peer_unlock (peer); /* peer bgp rsclient reference */ |
200df115 | 3079 | } |
fee0f4c6 | 3080 | |
b608d5b5 | 3081 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 3082 | |
3083 | return CMD_SUCCESS; | |
3084 | } | |
6b0655a2 | 3085 | |
718e3744 | 3086 | /* neighbor route-server-client. */ |
3087 | DEFUN (neighbor_route_server_client, | |
3088 | neighbor_route_server_client_cmd, | |
3089 | NEIGHBOR_CMD2 "route-server-client", | |
3090 | NEIGHBOR_STR | |
3091 | NEIGHBOR_ADDR_STR2 | |
3092 | "Configure a neighbor as Route Server client\n") | |
3093 | { | |
fee0f4c6 | 3094 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
3095 | bgp_node_safi(vty)); | |
718e3744 | 3096 | } |
3097 | ||
3098 | DEFUN (no_neighbor_route_server_client, | |
3099 | no_neighbor_route_server_client_cmd, | |
3100 | NO_NEIGHBOR_CMD2 "route-server-client", | |
3101 | NO_STR | |
3102 | NEIGHBOR_STR | |
3103 | NEIGHBOR_ADDR_STR2 | |
3104 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 3105 | { |
3106 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
3107 | bgp_node_safi(vty)); | |
3108 | } | |
6b0655a2 | 3109 | |
fee0f4c6 | 3110 | DEFUN (neighbor_nexthop_local_unchanged, |
3111 | neighbor_nexthop_local_unchanged_cmd, | |
3112 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3113 | NEIGHBOR_STR | |
3114 | NEIGHBOR_ADDR_STR2 | |
3115 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
3116 | "Leave link-local nexthop unchanged for this peer\n") | |
3117 | { | |
3118 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3119 | bgp_node_safi (vty), | |
3120 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
3121 | } | |
6b0655a2 | 3122 | |
fee0f4c6 | 3123 | DEFUN (no_neighbor_nexthop_local_unchanged, |
3124 | no_neighbor_nexthop_local_unchanged_cmd, | |
3125 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3126 | NO_STR | |
3127 | NEIGHBOR_STR | |
3128 | NEIGHBOR_ADDR_STR2 | |
3129 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
3130 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 3131 | { |
3132 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3133 | bgp_node_safi (vty), | |
fee0f4c6 | 3134 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 3135 | } |
6b0655a2 | 3136 | |
718e3744 | 3137 | DEFUN (neighbor_attr_unchanged, |
3138 | neighbor_attr_unchanged_cmd, | |
3139 | NEIGHBOR_CMD2 "attribute-unchanged", | |
3140 | NEIGHBOR_STR | |
3141 | NEIGHBOR_ADDR_STR2 | |
3142 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3143 | { | |
3144 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3145 | bgp_node_safi (vty), | |
3146 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3147 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3148 | PEER_FLAG_MED_UNCHANGED)); | |
3149 | } | |
3150 | ||
3151 | DEFUN (neighbor_attr_unchanged1, | |
3152 | neighbor_attr_unchanged1_cmd, | |
3153 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3154 | NEIGHBOR_STR | |
3155 | NEIGHBOR_ADDR_STR2 | |
3156 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3157 | "As-path attribute\n" | |
3158 | "Nexthop attribute\n" | |
3159 | "Med attribute\n") | |
3160 | { | |
3161 | u_int16_t flags = 0; | |
3162 | ||
3163 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3164 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3165 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3166 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3167 | else if (strncmp (argv[1], "med", 1) == 0) | |
3168 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3169 | ||
3170 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3171 | bgp_node_safi (vty), flags); | |
3172 | } | |
3173 | ||
3174 | DEFUN (neighbor_attr_unchanged2, | |
3175 | neighbor_attr_unchanged2_cmd, | |
3176 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
3177 | NEIGHBOR_STR | |
3178 | NEIGHBOR_ADDR_STR2 | |
3179 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3180 | "As-path attribute\n" | |
3181 | "Nexthop attribute\n" | |
3182 | "Med attribute\n") | |
3183 | { | |
3184 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
3185 | ||
3186 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
3187 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3188 | else if (strncmp (argv[1], "med", 1) == 0) | |
3189 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3190 | ||
3191 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3192 | bgp_node_safi (vty), flags); | |
3193 | ||
3194 | } | |
3195 | ||
3196 | DEFUN (neighbor_attr_unchanged3, | |
3197 | neighbor_attr_unchanged3_cmd, | |
3198 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
3199 | NEIGHBOR_STR | |
3200 | NEIGHBOR_ADDR_STR2 | |
3201 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3202 | "Nexthop attribute\n" | |
3203 | "As-path attribute\n" | |
3204 | "Med attribute\n") | |
3205 | { | |
3206 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
3207 | ||
3208 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3209 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3210 | else if (strncmp (argv[1], "med", 1) == 0) | |
3211 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3212 | ||
3213 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3214 | bgp_node_safi (vty), flags); | |
3215 | } | |
3216 | ||
3217 | DEFUN (neighbor_attr_unchanged4, | |
3218 | neighbor_attr_unchanged4_cmd, | |
3219 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3220 | NEIGHBOR_STR | |
3221 | NEIGHBOR_ADDR_STR2 | |
3222 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3223 | "Med attribute\n" | |
3224 | "As-path attribute\n" | |
3225 | "Nexthop attribute\n") | |
3226 | { | |
3227 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3228 | ||
3229 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3230 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3231 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3232 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3233 | ||
3234 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3235 | bgp_node_safi (vty), flags); | |
3236 | } | |
3237 | ||
3238 | ALIAS (neighbor_attr_unchanged, | |
3239 | neighbor_attr_unchanged5_cmd, | |
3240 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3241 | NEIGHBOR_STR | |
3242 | NEIGHBOR_ADDR_STR2 | |
3243 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3244 | "As-path attribute\n" | |
3245 | "Nexthop attribute\n" | |
3246 | "Med attribute\n") | |
3247 | ||
3248 | ALIAS (neighbor_attr_unchanged, | |
3249 | neighbor_attr_unchanged6_cmd, | |
3250 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3251 | NEIGHBOR_STR | |
3252 | NEIGHBOR_ADDR_STR2 | |
3253 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3254 | "As-path attribute\n" | |
3255 | "Med attribute\n" | |
3256 | "Nexthop attribute\n") | |
3257 | ||
3258 | ALIAS (neighbor_attr_unchanged, | |
3259 | neighbor_attr_unchanged7_cmd, | |
3260 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
3261 | NEIGHBOR_STR | |
3262 | NEIGHBOR_ADDR_STR2 | |
3263 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3264 | "Nexthop attribute\n" | |
3265 | "Med attribute\n" | |
3266 | "As-path attribute\n") | |
3267 | ||
3268 | ALIAS (neighbor_attr_unchanged, | |
3269 | neighbor_attr_unchanged8_cmd, | |
3270 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
3271 | NEIGHBOR_STR | |
3272 | NEIGHBOR_ADDR_STR2 | |
3273 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3274 | "Nexthop attribute\n" | |
3275 | "As-path attribute\n" | |
3276 | "Med attribute\n") | |
3277 | ||
3278 | ALIAS (neighbor_attr_unchanged, | |
3279 | neighbor_attr_unchanged9_cmd, | |
3280 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
3281 | NEIGHBOR_STR | |
3282 | NEIGHBOR_ADDR_STR2 | |
3283 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3284 | "Med attribute\n" | |
3285 | "Nexthop attribute\n" | |
3286 | "As-path attribute\n") | |
3287 | ||
3288 | ALIAS (neighbor_attr_unchanged, | |
3289 | neighbor_attr_unchanged10_cmd, | |
3290 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
3291 | NEIGHBOR_STR | |
3292 | NEIGHBOR_ADDR_STR2 | |
3293 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3294 | "Med attribute\n" | |
3295 | "As-path attribute\n" | |
3296 | "Nexthop attribute\n") | |
3297 | ||
3298 | DEFUN (no_neighbor_attr_unchanged, | |
3299 | no_neighbor_attr_unchanged_cmd, | |
3300 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
3301 | NO_STR | |
3302 | NEIGHBOR_STR | |
3303 | NEIGHBOR_ADDR_STR2 | |
3304 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3305 | { | |
3306 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3307 | bgp_node_safi (vty), | |
3308 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3309 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3310 | PEER_FLAG_MED_UNCHANGED)); | |
3311 | } | |
3312 | ||
3313 | DEFUN (no_neighbor_attr_unchanged1, | |
3314 | no_neighbor_attr_unchanged1_cmd, | |
3315 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3316 | NO_STR | |
3317 | NEIGHBOR_STR | |
3318 | NEIGHBOR_ADDR_STR2 | |
3319 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3320 | "As-path attribute\n" | |
3321 | "Nexthop attribute\n" | |
3322 | "Med attribute\n") | |
3323 | { | |
3324 | u_int16_t flags = 0; | |
3325 | ||
3326 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3327 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3328 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3329 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3330 | else if (strncmp (argv[1], "med", 1) == 0) | |
3331 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3332 | ||
3333 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3334 | bgp_node_safi (vty), flags); | |
3335 | } | |
3336 | ||
3337 | DEFUN (no_neighbor_attr_unchanged2, | |
3338 | no_neighbor_attr_unchanged2_cmd, | |
3339 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
3340 | NO_STR | |
3341 | NEIGHBOR_STR | |
3342 | NEIGHBOR_ADDR_STR2 | |
3343 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3344 | "As-path attribute\n" | |
3345 | "Nexthop attribute\n" | |
3346 | "Med attribute\n") | |
3347 | { | |
3348 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
3349 | ||
3350 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
3351 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3352 | else if (strncmp (argv[1], "med", 1) == 0) | |
3353 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3354 | ||
3355 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3356 | bgp_node_safi (vty), flags); | |
3357 | } | |
3358 | ||
3359 | DEFUN (no_neighbor_attr_unchanged3, | |
3360 | no_neighbor_attr_unchanged3_cmd, | |
3361 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
3362 | NO_STR | |
3363 | NEIGHBOR_STR | |
3364 | NEIGHBOR_ADDR_STR2 | |
3365 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3366 | "Nexthop attribute\n" | |
3367 | "As-path attribute\n" | |
3368 | "Med attribute\n") | |
3369 | { | |
3370 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
3371 | ||
3372 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3373 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3374 | else if (strncmp (argv[1], "med", 1) == 0) | |
3375 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3376 | ||
3377 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3378 | bgp_node_safi (vty), flags); | |
3379 | } | |
3380 | ||
3381 | DEFUN (no_neighbor_attr_unchanged4, | |
3382 | no_neighbor_attr_unchanged4_cmd, | |
3383 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3384 | NO_STR | |
3385 | NEIGHBOR_STR | |
3386 | NEIGHBOR_ADDR_STR2 | |
3387 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3388 | "Med attribute\n" | |
3389 | "As-path attribute\n" | |
3390 | "Nexthop attribute\n") | |
3391 | { | |
3392 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3393 | ||
3394 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3395 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3396 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3397 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3398 | ||
3399 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3400 | bgp_node_safi (vty), flags); | |
3401 | } | |
3402 | ||
3403 | ALIAS (no_neighbor_attr_unchanged, | |
3404 | no_neighbor_attr_unchanged5_cmd, | |
3405 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3406 | NO_STR | |
3407 | NEIGHBOR_STR | |
3408 | NEIGHBOR_ADDR_STR2 | |
3409 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3410 | "As-path attribute\n" | |
3411 | "Nexthop attribute\n" | |
3412 | "Med attribute\n") | |
3413 | ||
3414 | ALIAS (no_neighbor_attr_unchanged, | |
3415 | no_neighbor_attr_unchanged6_cmd, | |
3416 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3417 | NO_STR | |
3418 | NEIGHBOR_STR | |
3419 | NEIGHBOR_ADDR_STR2 | |
3420 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3421 | "As-path attribute\n" | |
3422 | "Med attribute\n" | |
3423 | "Nexthop attribute\n") | |
3424 | ||
3425 | ALIAS (no_neighbor_attr_unchanged, | |
3426 | no_neighbor_attr_unchanged7_cmd, | |
3427 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
3428 | NO_STR | |
3429 | NEIGHBOR_STR | |
3430 | NEIGHBOR_ADDR_STR2 | |
3431 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3432 | "Nexthop attribute\n" | |
3433 | "Med attribute\n" | |
3434 | "As-path attribute\n") | |
3435 | ||
3436 | ALIAS (no_neighbor_attr_unchanged, | |
3437 | no_neighbor_attr_unchanged8_cmd, | |
3438 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
3439 | NO_STR | |
3440 | NEIGHBOR_STR | |
3441 | NEIGHBOR_ADDR_STR2 | |
3442 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3443 | "Nexthop attribute\n" | |
3444 | "As-path attribute\n" | |
3445 | "Med attribute\n") | |
3446 | ||
3447 | ALIAS (no_neighbor_attr_unchanged, | |
3448 | no_neighbor_attr_unchanged9_cmd, | |
3449 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
3450 | NO_STR | |
3451 | NEIGHBOR_STR | |
3452 | NEIGHBOR_ADDR_STR2 | |
3453 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3454 | "Med attribute\n" | |
3455 | "Nexthop attribute\n" | |
3456 | "As-path attribute\n") | |
3457 | ||
3458 | ALIAS (no_neighbor_attr_unchanged, | |
3459 | no_neighbor_attr_unchanged10_cmd, | |
3460 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
3461 | NO_STR | |
3462 | NEIGHBOR_STR | |
3463 | NEIGHBOR_ADDR_STR2 | |
3464 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3465 | "Med attribute\n" | |
3466 | "As-path attribute\n" | |
3467 | "Nexthop attribute\n") | |
3468 | ||
3469 | /* For old version Zebra compatibility. */ | |
dd4c593f | 3470 | DEFUN_DEPRECATED (neighbor_transparent_as, |
3471 | neighbor_transparent_as_cmd, | |
3472 | NEIGHBOR_CMD "transparent-as", | |
3473 | NEIGHBOR_STR | |
3474 | NEIGHBOR_ADDR_STR | |
3475 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 3476 | { |
3477 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3478 | bgp_node_safi (vty), | |
3479 | PEER_FLAG_AS_PATH_UNCHANGED); | |
3480 | } | |
3481 | ||
dd4c593f | 3482 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
3483 | neighbor_transparent_nexthop_cmd, | |
3484 | NEIGHBOR_CMD "transparent-nexthop", | |
3485 | NEIGHBOR_STR | |
3486 | NEIGHBOR_ADDR_STR | |
3487 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 3488 | { |
3489 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3490 | bgp_node_safi (vty), | |
3491 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
3492 | } | |
6b0655a2 | 3493 | |
718e3744 | 3494 | /* EBGP multihop configuration. */ |
94f2b392 | 3495 | static int |
fd79ac91 | 3496 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
3497 | const char *ttl_str) | |
718e3744 | 3498 | { |
3499 | struct peer *peer; | |
fd79ac91 | 3500 | unsigned int ttl; |
718e3744 | 3501 | |
3502 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3503 | if (! peer) | |
3504 | return CMD_WARNING; | |
3505 | ||
3506 | if (! ttl_str) | |
3507 | ttl = TTL_MAX; | |
3508 | else | |
3509 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
3510 | ||
89b6d1f8 | 3511 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 3512 | } |
3513 | ||
94f2b392 | 3514 | static int |
fd79ac91 | 3515 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3516 | { |
3517 | struct peer *peer; | |
3518 | ||
3519 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3520 | if (! peer) | |
3521 | return CMD_WARNING; | |
3522 | ||
89b6d1f8 | 3523 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 3524 | } |
3525 | ||
3526 | /* neighbor ebgp-multihop. */ | |
3527 | DEFUN (neighbor_ebgp_multihop, | |
3528 | neighbor_ebgp_multihop_cmd, | |
3529 | NEIGHBOR_CMD2 "ebgp-multihop", | |
3530 | NEIGHBOR_STR | |
3531 | NEIGHBOR_ADDR_STR2 | |
3532 | "Allow EBGP neighbors not on directly connected networks\n") | |
3533 | { | |
3534 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
3535 | } | |
3536 | ||
3537 | DEFUN (neighbor_ebgp_multihop_ttl, | |
3538 | neighbor_ebgp_multihop_ttl_cmd, | |
3539 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3540 | NEIGHBOR_STR | |
3541 | NEIGHBOR_ADDR_STR2 | |
3542 | "Allow EBGP neighbors not on directly connected networks\n" | |
3543 | "maximum hop count\n") | |
3544 | { | |
3545 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
3546 | } | |
3547 | ||
3548 | DEFUN (no_neighbor_ebgp_multihop, | |
3549 | no_neighbor_ebgp_multihop_cmd, | |
3550 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
3551 | NO_STR | |
3552 | NEIGHBOR_STR | |
3553 | NEIGHBOR_ADDR_STR2 | |
3554 | "Allow EBGP neighbors not on directly connected networks\n") | |
3555 | { | |
3556 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
3557 | } | |
3558 | ||
3559 | ALIAS (no_neighbor_ebgp_multihop, | |
3560 | no_neighbor_ebgp_multihop_ttl_cmd, | |
3561 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3562 | NO_STR | |
3563 | NEIGHBOR_STR | |
3564 | NEIGHBOR_ADDR_STR2 | |
3565 | "Allow EBGP neighbors not on directly connected networks\n" | |
3566 | "maximum hop count\n") | |
6b0655a2 | 3567 | |
6ffd2079 | 3568 | /* disable-connected-check */ |
3569 | DEFUN (neighbor_disable_connected_check, | |
3570 | neighbor_disable_connected_check_cmd, | |
3571 | NEIGHBOR_CMD2 "disable-connected-check", | |
3572 | NEIGHBOR_STR | |
3573 | NEIGHBOR_ADDR_STR2 | |
3574 | "one-hop away EBGP peer using loopback address\n") | |
3575 | { | |
3576 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3577 | } | |
3578 | ||
3579 | DEFUN (no_neighbor_disable_connected_check, | |
3580 | no_neighbor_disable_connected_check_cmd, | |
3581 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
3582 | NO_STR | |
3583 | NEIGHBOR_STR | |
3584 | NEIGHBOR_ADDR_STR2 | |
3585 | "one-hop away EBGP peer using loopback address\n") | |
3586 | { | |
3587 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3588 | } | |
3589 | ||
718e3744 | 3590 | /* Enforce multihop. */ |
6ffd2079 | 3591 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 3592 | neighbor_enforce_multihop_cmd, |
3593 | NEIGHBOR_CMD2 "enforce-multihop", | |
3594 | NEIGHBOR_STR | |
3595 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3596 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 3597 | |
6ffd2079 | 3598 | /* Enforce multihop. */ |
3599 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 3600 | no_neighbor_enforce_multihop_cmd, |
3601 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
3602 | NO_STR | |
3603 | NEIGHBOR_STR | |
3604 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3605 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 3606 | |
718e3744 | 3607 | DEFUN (neighbor_description, |
3608 | neighbor_description_cmd, | |
3609 | NEIGHBOR_CMD2 "description .LINE", | |
3610 | NEIGHBOR_STR | |
3611 | NEIGHBOR_ADDR_STR2 | |
3612 | "Neighbor specific description\n" | |
3613 | "Up to 80 characters describing this neighbor\n") | |
3614 | { | |
3615 | struct peer *peer; | |
718e3744 | 3616 | char *str; |
718e3744 | 3617 | |
3618 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3619 | if (! peer) | |
3620 | return CMD_WARNING; | |
3621 | ||
3622 | if (argc == 1) | |
3623 | return CMD_SUCCESS; | |
3624 | ||
3b8b1855 | 3625 | str = argv_concat(argv, argc, 1); |
718e3744 | 3626 | |
3627 | peer_description_set (peer, str); | |
3628 | ||
3b8b1855 | 3629 | XFREE (MTYPE_TMP, str); |
718e3744 | 3630 | |
3631 | return CMD_SUCCESS; | |
3632 | } | |
3633 | ||
3634 | DEFUN (no_neighbor_description, | |
3635 | no_neighbor_description_cmd, | |
3636 | NO_NEIGHBOR_CMD2 "description", | |
3637 | NO_STR | |
3638 | NEIGHBOR_STR | |
3639 | NEIGHBOR_ADDR_STR2 | |
3640 | "Neighbor specific description\n") | |
3641 | { | |
3642 | struct peer *peer; | |
3643 | ||
3644 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3645 | if (! peer) | |
3646 | return CMD_WARNING; | |
3647 | ||
3648 | peer_description_unset (peer); | |
3649 | ||
3650 | return CMD_SUCCESS; | |
3651 | } | |
3652 | ||
3653 | ALIAS (no_neighbor_description, | |
3654 | no_neighbor_description_val_cmd, | |
3655 | NO_NEIGHBOR_CMD2 "description .LINE", | |
3656 | NO_STR | |
3657 | NEIGHBOR_STR | |
3658 | NEIGHBOR_ADDR_STR2 | |
3659 | "Neighbor specific description\n" | |
3660 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 3661 | |
718e3744 | 3662 | /* Neighbor update-source. */ |
94f2b392 | 3663 | static int |
fd79ac91 | 3664 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
3665 | const char *source_str) | |
718e3744 | 3666 | { |
3667 | struct peer *peer; | |
718e3744 | 3668 | |
3669 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3670 | if (! peer) | |
3671 | return CMD_WARNING; | |
3672 | ||
a80beece DS |
3673 | if (peer->conf_if) |
3674 | return CMD_WARNING; | |
3675 | ||
718e3744 | 3676 | if (source_str) |
3677 | { | |
c63b83fe JBD |
3678 | union sockunion su; |
3679 | int ret = str2sockunion (source_str, &su); | |
3680 | ||
3681 | if (ret == 0) | |
3682 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 3683 | else |
3684 | peer_update_source_if_set (peer, source_str); | |
3685 | } | |
3686 | else | |
3687 | peer_update_source_unset (peer); | |
3688 | ||
3689 | return CMD_SUCCESS; | |
3690 | } | |
3691 | ||
9a1a331d | 3692 | #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)" |
369688c0 PJ |
3693 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
3694 | "IPv4 address\n" \ | |
9a1a331d PJ |
3695 | "IPv6 address\n" \ |
3696 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 3697 | |
718e3744 | 3698 | DEFUN (neighbor_update_source, |
3699 | neighbor_update_source_cmd, | |
369688c0 | 3700 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
718e3744 | 3701 | NEIGHBOR_STR |
3702 | NEIGHBOR_ADDR_STR2 | |
3703 | "Source of routing updates\n" | |
369688c0 | 3704 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 3705 | { |
3706 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
3707 | } | |
3708 | ||
3709 | DEFUN (no_neighbor_update_source, | |
3710 | no_neighbor_update_source_cmd, | |
3711 | NO_NEIGHBOR_CMD2 "update-source", | |
3712 | NO_STR | |
3713 | NEIGHBOR_STR | |
3714 | NEIGHBOR_ADDR_STR2 | |
369688c0 | 3715 | "Source of routing updates\n") |
718e3744 | 3716 | { |
3717 | return peer_update_source_vty (vty, argv[0], NULL); | |
3718 | } | |
6b0655a2 | 3719 | |
94f2b392 | 3720 | static int |
fd79ac91 | 3721 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
3722 | afi_t afi, safi_t safi, | |
3723 | const char *rmap, int set) | |
718e3744 | 3724 | { |
3725 | int ret; | |
3726 | struct peer *peer; | |
3727 | ||
3728 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3729 | if (! peer) | |
3730 | return CMD_WARNING; | |
3731 | ||
3732 | if (set) | |
3733 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
3734 | else | |
3735 | ret = peer_default_originate_unset (peer, afi, safi); | |
3736 | ||
3737 | return bgp_vty_return (vty, ret); | |
3738 | } | |
3739 | ||
3740 | /* neighbor default-originate. */ | |
3741 | DEFUN (neighbor_default_originate, | |
3742 | neighbor_default_originate_cmd, | |
3743 | NEIGHBOR_CMD2 "default-originate", | |
3744 | NEIGHBOR_STR | |
3745 | NEIGHBOR_ADDR_STR2 | |
3746 | "Originate default route to this neighbor\n") | |
3747 | { | |
3748 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3749 | bgp_node_safi (vty), NULL, 1); | |
3750 | } | |
3751 | ||
3752 | DEFUN (neighbor_default_originate_rmap, | |
3753 | neighbor_default_originate_rmap_cmd, | |
3754 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
3755 | NEIGHBOR_STR | |
3756 | NEIGHBOR_ADDR_STR2 | |
3757 | "Originate default route to this neighbor\n" | |
3758 | "Route-map to specify criteria to originate default\n" | |
3759 | "route-map name\n") | |
3760 | { | |
3761 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3762 | bgp_node_safi (vty), argv[1], 1); | |
3763 | } | |
3764 | ||
3765 | DEFUN (no_neighbor_default_originate, | |
3766 | no_neighbor_default_originate_cmd, | |
3767 | NO_NEIGHBOR_CMD2 "default-originate", | |
3768 | NO_STR | |
3769 | NEIGHBOR_STR | |
3770 | NEIGHBOR_ADDR_STR2 | |
3771 | "Originate default route to this neighbor\n") | |
3772 | { | |
3773 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3774 | bgp_node_safi (vty), NULL, 0); | |
3775 | } | |
3776 | ||
3777 | ALIAS (no_neighbor_default_originate, | |
3778 | no_neighbor_default_originate_rmap_cmd, | |
3779 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
3780 | NO_STR | |
3781 | NEIGHBOR_STR | |
3782 | NEIGHBOR_ADDR_STR2 | |
3783 | "Originate default route to this neighbor\n" | |
3784 | "Route-map to specify criteria to originate default\n" | |
3785 | "route-map name\n") | |
6b0655a2 | 3786 | |
718e3744 | 3787 | /* Set neighbor's BGP port. */ |
94f2b392 | 3788 | static int |
fd79ac91 | 3789 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
3790 | const char *port_str) | |
718e3744 | 3791 | { |
3792 | struct peer *peer; | |
3793 | u_int16_t port; | |
3794 | struct servent *sp; | |
3795 | ||
3796 | peer = peer_lookup_vty (vty, ip_str); | |
3797 | if (! peer) | |
3798 | return CMD_WARNING; | |
3799 | ||
3800 | if (! port_str) | |
3801 | { | |
3802 | sp = getservbyname ("bgp", "tcp"); | |
3803 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
3804 | } | |
3805 | else | |
3806 | { | |
3807 | VTY_GET_INTEGER("port", port, port_str); | |
3808 | } | |
3809 | ||
3810 | peer_port_set (peer, port); | |
3811 | ||
3812 | return CMD_SUCCESS; | |
3813 | } | |
3814 | ||
f418446b | 3815 | /* Set specified peer's BGP port. */ |
718e3744 | 3816 | DEFUN (neighbor_port, |
3817 | neighbor_port_cmd, | |
3818 | NEIGHBOR_CMD "port <0-65535>", | |
3819 | NEIGHBOR_STR | |
3820 | NEIGHBOR_ADDR_STR | |
3821 | "Neighbor's BGP port\n" | |
3822 | "TCP port number\n") | |
3823 | { | |
3824 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
3825 | } | |
3826 | ||
3827 | DEFUN (no_neighbor_port, | |
3828 | no_neighbor_port_cmd, | |
3829 | NO_NEIGHBOR_CMD "port", | |
3830 | NO_STR | |
3831 | NEIGHBOR_STR | |
3832 | NEIGHBOR_ADDR_STR | |
3833 | "Neighbor's BGP port\n") | |
3834 | { | |
3835 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
3836 | } | |
3837 | ||
3838 | ALIAS (no_neighbor_port, | |
3839 | no_neighbor_port_val_cmd, | |
3840 | NO_NEIGHBOR_CMD "port <0-65535>", | |
3841 | NO_STR | |
3842 | NEIGHBOR_STR | |
3843 | NEIGHBOR_ADDR_STR | |
3844 | "Neighbor's BGP port\n" | |
3845 | "TCP port number\n") | |
6b0655a2 | 3846 | |
718e3744 | 3847 | /* neighbor weight. */ |
94f2b392 | 3848 | static int |
fd79ac91 | 3849 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
3850 | const char *weight_str) | |
718e3744 | 3851 | { |
3852 | int ret; | |
3853 | struct peer *peer; | |
3854 | unsigned long weight; | |
3855 | ||
3856 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3857 | if (! peer) | |
3858 | return CMD_WARNING; | |
3859 | ||
3860 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
3861 | ||
3862 | ret = peer_weight_set (peer, weight); | |
3863 | ||
3864 | return CMD_SUCCESS; | |
3865 | } | |
3866 | ||
94f2b392 | 3867 | static int |
fd79ac91 | 3868 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3869 | { |
3870 | struct peer *peer; | |
3871 | ||
3872 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3873 | if (! peer) | |
3874 | return CMD_WARNING; | |
3875 | ||
3876 | peer_weight_unset (peer); | |
3877 | ||
3878 | return CMD_SUCCESS; | |
3879 | } | |
3880 | ||
3881 | DEFUN (neighbor_weight, | |
3882 | neighbor_weight_cmd, | |
3883 | NEIGHBOR_CMD2 "weight <0-65535>", | |
3884 | NEIGHBOR_STR | |
3885 | NEIGHBOR_ADDR_STR2 | |
3886 | "Set default weight for routes from this neighbor\n" | |
3887 | "default weight\n") | |
3888 | { | |
3889 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
3890 | } | |
3891 | ||
3892 | DEFUN (no_neighbor_weight, | |
3893 | no_neighbor_weight_cmd, | |
3894 | NO_NEIGHBOR_CMD2 "weight", | |
3895 | NO_STR | |
3896 | NEIGHBOR_STR | |
3897 | NEIGHBOR_ADDR_STR2 | |
3898 | "Set default weight for routes from this neighbor\n") | |
3899 | { | |
3900 | return peer_weight_unset_vty (vty, argv[0]); | |
3901 | } | |
3902 | ||
3903 | ALIAS (no_neighbor_weight, | |
3904 | no_neighbor_weight_val_cmd, | |
3905 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
3906 | NO_STR | |
3907 | NEIGHBOR_STR | |
3908 | NEIGHBOR_ADDR_STR2 | |
3909 | "Set default weight for routes from this neighbor\n" | |
3910 | "default weight\n") | |
6b0655a2 | 3911 | |
718e3744 | 3912 | /* Override capability negotiation. */ |
3913 | DEFUN (neighbor_override_capability, | |
3914 | neighbor_override_capability_cmd, | |
3915 | NEIGHBOR_CMD2 "override-capability", | |
3916 | NEIGHBOR_STR | |
3917 | NEIGHBOR_ADDR_STR2 | |
3918 | "Override capability negotiation result\n") | |
3919 | { | |
3920 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3921 | } | |
3922 | ||
3923 | DEFUN (no_neighbor_override_capability, | |
3924 | no_neighbor_override_capability_cmd, | |
3925 | NO_NEIGHBOR_CMD2 "override-capability", | |
3926 | NO_STR | |
3927 | NEIGHBOR_STR | |
3928 | NEIGHBOR_ADDR_STR2 | |
3929 | "Override capability negotiation result\n") | |
3930 | { | |
3931 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3932 | } | |
6b0655a2 | 3933 | |
718e3744 | 3934 | DEFUN (neighbor_strict_capability, |
3935 | neighbor_strict_capability_cmd, | |
3936 | NEIGHBOR_CMD "strict-capability-match", | |
3937 | NEIGHBOR_STR | |
3938 | NEIGHBOR_ADDR_STR | |
3939 | "Strict capability negotiation match\n") | |
3940 | { | |
3941 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3942 | } | |
3943 | ||
3944 | DEFUN (no_neighbor_strict_capability, | |
3945 | no_neighbor_strict_capability_cmd, | |
3946 | NO_NEIGHBOR_CMD "strict-capability-match", | |
3947 | NO_STR | |
3948 | NEIGHBOR_STR | |
3949 | NEIGHBOR_ADDR_STR | |
3950 | "Strict capability negotiation match\n") | |
3951 | { | |
3952 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3953 | } | |
6b0655a2 | 3954 | |
94f2b392 | 3955 | static int |
fd79ac91 | 3956 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
3957 | const char *keep_str, const char *hold_str) | |
718e3744 | 3958 | { |
3959 | int ret; | |
3960 | struct peer *peer; | |
3961 | u_int32_t keepalive; | |
3962 | u_int32_t holdtime; | |
3963 | ||
3964 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3965 | if (! peer) | |
3966 | return CMD_WARNING; | |
3967 | ||
3968 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
3969 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
3970 | ||
3971 | ret = peer_timers_set (peer, keepalive, holdtime); | |
3972 | ||
3973 | return bgp_vty_return (vty, ret); | |
3974 | } | |
6b0655a2 | 3975 | |
94f2b392 | 3976 | static int |
fd79ac91 | 3977 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3978 | { |
3979 | int ret; | |
3980 | struct peer *peer; | |
3981 | ||
3982 | peer = peer_lookup_vty (vty, ip_str); | |
3983 | if (! peer) | |
3984 | return CMD_WARNING; | |
3985 | ||
3986 | ret = peer_timers_unset (peer); | |
3987 | ||
3988 | return bgp_vty_return (vty, ret); | |
3989 | } | |
3990 | ||
3991 | DEFUN (neighbor_timers, | |
3992 | neighbor_timers_cmd, | |
3993 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
3994 | NEIGHBOR_STR | |
3995 | NEIGHBOR_ADDR_STR2 | |
3996 | "BGP per neighbor timers\n" | |
3997 | "Keepalive interval\n" | |
3998 | "Holdtime\n") | |
3999 | { | |
4000 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4001 | } | |
4002 | ||
4003 | DEFUN (no_neighbor_timers, | |
4004 | no_neighbor_timers_cmd, | |
4005 | NO_NEIGHBOR_CMD2 "timers", | |
4006 | NO_STR | |
4007 | NEIGHBOR_STR | |
4008 | NEIGHBOR_ADDR_STR2 | |
4009 | "BGP per neighbor timers\n") | |
4010 | { | |
4011 | return peer_timers_unset_vty (vty, argv[0]); | |
4012 | } | |
6b0655a2 | 4013 | |
94f2b392 | 4014 | static int |
fd79ac91 | 4015 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4016 | const char *time_str) | |
718e3744 | 4017 | { |
4018 | int ret; | |
4019 | struct peer *peer; | |
4020 | u_int32_t connect; | |
4021 | ||
966f821c | 4022 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4023 | if (! peer) |
4024 | return CMD_WARNING; | |
4025 | ||
4026 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4027 | ||
4028 | ret = peer_timers_connect_set (peer, connect); | |
4029 | ||
966f821c | 4030 | return bgp_vty_return (vty, ret); |
718e3744 | 4031 | } |
4032 | ||
94f2b392 | 4033 | static int |
fd79ac91 | 4034 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4035 | { |
4036 | int ret; | |
4037 | struct peer *peer; | |
4038 | ||
4039 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4040 | if (! peer) | |
4041 | return CMD_WARNING; | |
4042 | ||
4043 | ret = peer_timers_connect_unset (peer); | |
4044 | ||
966f821c | 4045 | return bgp_vty_return (vty, ret); |
718e3744 | 4046 | } |
4047 | ||
4048 | DEFUN (neighbor_timers_connect, | |
4049 | neighbor_timers_connect_cmd, | |
966f821c | 4050 | NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4051 | NEIGHBOR_STR |
966f821c | 4052 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4053 | "BGP per neighbor timers\n" |
4054 | "BGP connect timer\n" | |
4055 | "Connect timer\n") | |
4056 | { | |
4057 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
4058 | } | |
4059 | ||
4060 | DEFUN (no_neighbor_timers_connect, | |
4061 | no_neighbor_timers_connect_cmd, | |
966f821c | 4062 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 4063 | NO_STR |
4064 | NEIGHBOR_STR | |
966f821c | 4065 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4066 | "BGP per neighbor timers\n" |
4067 | "BGP connect timer\n") | |
4068 | { | |
4069 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
4070 | } | |
4071 | ||
4072 | ALIAS (no_neighbor_timers_connect, | |
4073 | no_neighbor_timers_connect_val_cmd, | |
966f821c | 4074 | NO_NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4075 | NO_STR |
4076 | NEIGHBOR_STR | |
966f821c | 4077 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4078 | "BGP per neighbor timers\n" |
4079 | "BGP connect timer\n" | |
4080 | "Connect timer\n") | |
6b0655a2 | 4081 | |
94f2b392 | 4082 | static int |
fd79ac91 | 4083 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
4084 | const char *time_str, int set) | |
718e3744 | 4085 | { |
4086 | int ret; | |
4087 | struct peer *peer; | |
4088 | u_int32_t routeadv = 0; | |
4089 | ||
966f821c | 4090 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4091 | if (! peer) |
4092 | return CMD_WARNING; | |
4093 | ||
4094 | if (time_str) | |
4095 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
4096 | ||
4097 | if (set) | |
4098 | ret = peer_advertise_interval_set (peer, routeadv); | |
4099 | else | |
4100 | ret = peer_advertise_interval_unset (peer); | |
4101 | ||
966f821c | 4102 | return bgp_vty_return (vty, ret); |
718e3744 | 4103 | } |
4104 | ||
4105 | DEFUN (neighbor_advertise_interval, | |
4106 | neighbor_advertise_interval_cmd, | |
966f821c | 4107 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4108 | NEIGHBOR_STR |
966f821c | 4109 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4110 | "Minimum interval between sending BGP routing updates\n" |
4111 | "time in seconds\n") | |
4112 | { | |
4113 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
4114 | } | |
4115 | ||
4116 | DEFUN (no_neighbor_advertise_interval, | |
4117 | no_neighbor_advertise_interval_cmd, | |
966f821c | 4118 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 4119 | NO_STR |
4120 | NEIGHBOR_STR | |
966f821c | 4121 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4122 | "Minimum interval between sending BGP routing updates\n") |
4123 | { | |
4124 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
4125 | } | |
4126 | ||
4127 | ALIAS (no_neighbor_advertise_interval, | |
4128 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 4129 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4130 | NO_STR |
4131 | NEIGHBOR_STR | |
966f821c | 4132 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4133 | "Minimum interval between sending BGP routing updates\n" |
4134 | "time in seconds\n") | |
6b0655a2 | 4135 | |
518f0eb1 DS |
4136 | /* Time to wait before processing route-map updates */ |
4137 | DEFUN (bgp_set_route_map_delay_timer, | |
4138 | bgp_set_route_map_delay_timer_cmd, | |
4139 | "bgp route-map delay-timer <0-600>", | |
4140 | SET_STR | |
4141 | "BGP route-map delay timer\n" | |
4142 | "Time in secs to wait before processing route-map changes\n" | |
4143 | "0 disables the timer and no route updates happen when\n" | |
4144 | "route-maps change") | |
4145 | { | |
4146 | u_int32_t rmap_delay_timer; | |
4147 | struct bgp *bgp; | |
4148 | ||
4149 | bgp = vty->index; | |
4150 | if (argv[0]) | |
4151 | { | |
4152 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
4153 | bgp->rmap_update_timer = rmap_delay_timer; | |
4154 | ||
4155 | /* if the dynamic update handling is being disabled, and a timer is | |
4156 | * running, stop the timer and act as if the timer has already fired. | |
4157 | */ | |
4158 | if (!rmap_delay_timer && bgp->t_rmap_update ) | |
4159 | { | |
4160 | BGP_TIMER_OFF(bgp->t_rmap_update); | |
4161 | thread_execute (bm->master, bgp_route_map_update_timer, &bgp, 0); | |
4162 | } | |
4163 | return CMD_SUCCESS; | |
4164 | } | |
4165 | else | |
4166 | CMD_WARNING; | |
4167 | } | |
4168 | ||
4169 | DEFUN (no_bgp_set_route_map_delay_timer, | |
4170 | no_bgp_set_route_map_delay_timer_cmd, | |
4171 | "no bgp route-map delay-timer", | |
4172 | NO_STR | |
4173 | "Default BGP route-map delay timer\n" | |
4174 | "Reset to default time to wait for processing route-map changes") | |
4175 | { | |
4176 | u_int32_t rmap_delay_timer; | |
4177 | struct bgp *bgp; | |
4178 | ||
4179 | bgp = vty->index; | |
4180 | bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; | |
4181 | ||
4182 | return CMD_SUCCESS; | |
4183 | } | |
4184 | ||
718e3744 | 4185 | /* neighbor interface */ |
94f2b392 | 4186 | static int |
fd79ac91 | 4187 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 4188 | { |
4189 | int ret; | |
4190 | struct peer *peer; | |
4191 | ||
4192 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 4193 | if (! peer || peer->conf_if) |
718e3744 | 4194 | return CMD_WARNING; |
4195 | ||
4196 | if (str) | |
4197 | ret = peer_interface_set (peer, str); | |
4198 | else | |
4199 | ret = peer_interface_unset (peer); | |
4200 | ||
4201 | return CMD_SUCCESS; | |
4202 | } | |
4203 | ||
4204 | DEFUN (neighbor_interface, | |
4205 | neighbor_interface_cmd, | |
4206 | NEIGHBOR_CMD "interface WORD", | |
4207 | NEIGHBOR_STR | |
4208 | NEIGHBOR_ADDR_STR | |
4209 | "Interface\n" | |
4210 | "Interface name\n") | |
4211 | { | |
4212 | return peer_interface_vty (vty, argv[0], argv[1]); | |
4213 | } | |
4214 | ||
4215 | DEFUN (no_neighbor_interface, | |
4216 | no_neighbor_interface_cmd, | |
4217 | NO_NEIGHBOR_CMD "interface WORD", | |
4218 | NO_STR | |
4219 | NEIGHBOR_STR | |
4220 | NEIGHBOR_ADDR_STR | |
4221 | "Interface\n" | |
4222 | "Interface name\n") | |
4223 | { | |
4224 | return peer_interface_vty (vty, argv[0], NULL); | |
4225 | } | |
6b0655a2 | 4226 | |
718e3744 | 4227 | /* Set distribute list to the peer. */ |
94f2b392 | 4228 | static int |
fd79ac91 | 4229 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
4230 | afi_t afi, safi_t safi, | |
4231 | const char *name_str, const char *direct_str) | |
718e3744 | 4232 | { |
4233 | int ret; | |
4234 | struct peer *peer; | |
4235 | int direct = FILTER_IN; | |
4236 | ||
4237 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4238 | if (! peer) | |
4239 | return CMD_WARNING; | |
4240 | ||
4241 | /* Check filter direction. */ | |
4242 | if (strncmp (direct_str, "i", 1) == 0) | |
4243 | direct = FILTER_IN; | |
4244 | else if (strncmp (direct_str, "o", 1) == 0) | |
4245 | direct = FILTER_OUT; | |
4246 | ||
4247 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
4248 | ||
4249 | return bgp_vty_return (vty, ret); | |
4250 | } | |
4251 | ||
94f2b392 | 4252 | static int |
fd79ac91 | 4253 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4254 | safi_t safi, const char *direct_str) | |
718e3744 | 4255 | { |
4256 | int ret; | |
4257 | struct peer *peer; | |
4258 | int direct = FILTER_IN; | |
4259 | ||
4260 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4261 | if (! peer) | |
4262 | return CMD_WARNING; | |
4263 | ||
4264 | /* Check filter direction. */ | |
4265 | if (strncmp (direct_str, "i", 1) == 0) | |
4266 | direct = FILTER_IN; | |
4267 | else if (strncmp (direct_str, "o", 1) == 0) | |
4268 | direct = FILTER_OUT; | |
4269 | ||
4270 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
4271 | ||
4272 | return bgp_vty_return (vty, ret); | |
4273 | } | |
4274 | ||
4275 | DEFUN (neighbor_distribute_list, | |
4276 | neighbor_distribute_list_cmd, | |
4277 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4278 | NEIGHBOR_STR | |
4279 | NEIGHBOR_ADDR_STR2 | |
4280 | "Filter updates to/from this neighbor\n" | |
4281 | "IP access-list number\n" | |
4282 | "IP access-list number (expanded range)\n" | |
4283 | "IP Access-list name\n" | |
4284 | "Filter incoming updates\n" | |
4285 | "Filter outgoing updates\n") | |
4286 | { | |
4287 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4288 | bgp_node_safi (vty), argv[1], argv[2]); | |
4289 | } | |
4290 | ||
4291 | DEFUN (no_neighbor_distribute_list, | |
4292 | no_neighbor_distribute_list_cmd, | |
4293 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4294 | NO_STR | |
4295 | NEIGHBOR_STR | |
4296 | NEIGHBOR_ADDR_STR2 | |
4297 | "Filter updates to/from this neighbor\n" | |
4298 | "IP access-list number\n" | |
4299 | "IP access-list number (expanded range)\n" | |
4300 | "IP Access-list name\n" | |
4301 | "Filter incoming updates\n" | |
4302 | "Filter outgoing updates\n") | |
4303 | { | |
4304 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4305 | bgp_node_safi (vty), argv[2]); | |
4306 | } | |
6b0655a2 | 4307 | |
718e3744 | 4308 | /* Set prefix list to the peer. */ |
94f2b392 | 4309 | static int |
fd79ac91 | 4310 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4311 | safi_t safi, const char *name_str, | |
4312 | const char *direct_str) | |
718e3744 | 4313 | { |
4314 | int ret; | |
4315 | struct peer *peer; | |
4316 | int direct = FILTER_IN; | |
4317 | ||
4318 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4319 | if (! peer) | |
4320 | return CMD_WARNING; | |
4321 | ||
4322 | /* Check filter direction. */ | |
4323 | if (strncmp (direct_str, "i", 1) == 0) | |
4324 | direct = FILTER_IN; | |
4325 | else if (strncmp (direct_str, "o", 1) == 0) | |
4326 | direct = FILTER_OUT; | |
4327 | ||
4328 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
4329 | ||
4330 | return bgp_vty_return (vty, ret); | |
4331 | } | |
4332 | ||
94f2b392 | 4333 | static int |
fd79ac91 | 4334 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4335 | safi_t safi, const char *direct_str) | |
718e3744 | 4336 | { |
4337 | int ret; | |
4338 | struct peer *peer; | |
4339 | int direct = FILTER_IN; | |
4340 | ||
4341 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4342 | if (! peer) | |
4343 | return CMD_WARNING; | |
4344 | ||
4345 | /* Check filter direction. */ | |
4346 | if (strncmp (direct_str, "i", 1) == 0) | |
4347 | direct = FILTER_IN; | |
4348 | else if (strncmp (direct_str, "o", 1) == 0) | |
4349 | direct = FILTER_OUT; | |
4350 | ||
4351 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
4352 | ||
4353 | return bgp_vty_return (vty, ret); | |
4354 | } | |
4355 | ||
4356 | DEFUN (neighbor_prefix_list, | |
4357 | neighbor_prefix_list_cmd, | |
4358 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
4359 | NEIGHBOR_STR | |
4360 | NEIGHBOR_ADDR_STR2 | |
4361 | "Filter updates to/from this neighbor\n" | |
4362 | "Name of a prefix list\n" | |
4363 | "Filter incoming updates\n" | |
4364 | "Filter outgoing updates\n") | |
4365 | { | |
4366 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4367 | bgp_node_safi (vty), argv[1], argv[2]); | |
4368 | } | |
4369 | ||
4370 | DEFUN (no_neighbor_prefix_list, | |
4371 | no_neighbor_prefix_list_cmd, | |
4372 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
4373 | NO_STR | |
4374 | NEIGHBOR_STR | |
4375 | NEIGHBOR_ADDR_STR2 | |
4376 | "Filter updates to/from this neighbor\n" | |
4377 | "Name of a prefix list\n" | |
4378 | "Filter incoming updates\n" | |
4379 | "Filter outgoing updates\n") | |
4380 | { | |
4381 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4382 | bgp_node_safi (vty), argv[2]); | |
4383 | } | |
6b0655a2 | 4384 | |
94f2b392 | 4385 | static int |
fd79ac91 | 4386 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
4387 | afi_t afi, safi_t safi, | |
4388 | const char *name_str, const char *direct_str) | |
718e3744 | 4389 | { |
4390 | int ret; | |
4391 | struct peer *peer; | |
4392 | int direct = FILTER_IN; | |
4393 | ||
4394 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4395 | if (! peer) | |
4396 | return CMD_WARNING; | |
4397 | ||
4398 | /* Check filter direction. */ | |
4399 | if (strncmp (direct_str, "i", 1) == 0) | |
4400 | direct = FILTER_IN; | |
4401 | else if (strncmp (direct_str, "o", 1) == 0) | |
4402 | direct = FILTER_OUT; | |
4403 | ||
4404 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
4405 | ||
4406 | return bgp_vty_return (vty, ret); | |
4407 | } | |
4408 | ||
94f2b392 | 4409 | static int |
fd79ac91 | 4410 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
4411 | afi_t afi, safi_t safi, | |
4412 | const char *direct_str) | |
718e3744 | 4413 | { |
4414 | int ret; | |
4415 | struct peer *peer; | |
4416 | int direct = FILTER_IN; | |
4417 | ||
4418 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4419 | if (! peer) | |
4420 | return CMD_WARNING; | |
4421 | ||
4422 | /* Check filter direction. */ | |
4423 | if (strncmp (direct_str, "i", 1) == 0) | |
4424 | direct = FILTER_IN; | |
4425 | else if (strncmp (direct_str, "o", 1) == 0) | |
4426 | direct = FILTER_OUT; | |
4427 | ||
4428 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
4429 | ||
4430 | return bgp_vty_return (vty, ret); | |
4431 | } | |
4432 | ||
4433 | DEFUN (neighbor_filter_list, | |
4434 | neighbor_filter_list_cmd, | |
4435 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
4436 | NEIGHBOR_STR | |
4437 | NEIGHBOR_ADDR_STR2 | |
4438 | "Establish BGP filters\n" | |
4439 | "AS path access-list name\n" | |
4440 | "Filter incoming routes\n" | |
4441 | "Filter outgoing routes\n") | |
4442 | { | |
4443 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4444 | bgp_node_safi (vty), argv[1], argv[2]); | |
4445 | } | |
4446 | ||
4447 | DEFUN (no_neighbor_filter_list, | |
4448 | no_neighbor_filter_list_cmd, | |
4449 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
4450 | NO_STR | |
4451 | NEIGHBOR_STR | |
4452 | NEIGHBOR_ADDR_STR2 | |
4453 | "Establish BGP filters\n" | |
4454 | "AS path access-list name\n" | |
4455 | "Filter incoming routes\n" | |
4456 | "Filter outgoing routes\n") | |
4457 | { | |
4458 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4459 | bgp_node_safi (vty), argv[2]); | |
4460 | } | |
6b0655a2 | 4461 | |
718e3744 | 4462 | /* Set route-map to the peer. */ |
94f2b392 | 4463 | static int |
fd79ac91 | 4464 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
4465 | afi_t afi, safi_t safi, | |
4466 | const char *name_str, const char *direct_str) | |
718e3744 | 4467 | { |
4468 | int ret; | |
4469 | struct peer *peer; | |
fee0f4c6 | 4470 | int direct = RMAP_IN; |
718e3744 | 4471 | |
4472 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4473 | if (! peer) | |
4474 | return CMD_WARNING; | |
4475 | ||
4476 | /* Check filter direction. */ | |
fee0f4c6 | 4477 | if (strncmp (direct_str, "in", 2) == 0) |
4478 | direct = RMAP_IN; | |
718e3744 | 4479 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 4480 | direct = RMAP_OUT; |
4481 | else if (strncmp (direct_str, "im", 2) == 0) | |
4482 | direct = RMAP_IMPORT; | |
4483 | else if (strncmp (direct_str, "e", 1) == 0) | |
4484 | direct = RMAP_EXPORT; | |
718e3744 | 4485 | |
4486 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
4487 | ||
4488 | return bgp_vty_return (vty, ret); | |
4489 | } | |
4490 | ||
94f2b392 | 4491 | static int |
fd79ac91 | 4492 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4493 | safi_t safi, const char *direct_str) | |
718e3744 | 4494 | { |
4495 | int ret; | |
4496 | struct peer *peer; | |
fee0f4c6 | 4497 | int direct = RMAP_IN; |
718e3744 | 4498 | |
4499 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4500 | if (! peer) | |
4501 | return CMD_WARNING; | |
4502 | ||
4503 | /* Check filter direction. */ | |
fee0f4c6 | 4504 | if (strncmp (direct_str, "in", 2) == 0) |
4505 | direct = RMAP_IN; | |
718e3744 | 4506 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 4507 | direct = RMAP_OUT; |
4508 | else if (strncmp (direct_str, "im", 2) == 0) | |
4509 | direct = RMAP_IMPORT; | |
4510 | else if (strncmp (direct_str, "e", 1) == 0) | |
4511 | direct = RMAP_EXPORT; | |
718e3744 | 4512 | |
4513 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
4514 | ||
4515 | return bgp_vty_return (vty, ret); | |
4516 | } | |
4517 | ||
4518 | DEFUN (neighbor_route_map, | |
4519 | neighbor_route_map_cmd, | |
fee0f4c6 | 4520 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 4521 | NEIGHBOR_STR |
4522 | NEIGHBOR_ADDR_STR2 | |
4523 | "Apply route map to neighbor\n" | |
4524 | "Name of route map\n" | |
4525 | "Apply map to incoming routes\n" | |
fee0f4c6 | 4526 | "Apply map to outbound routes\n" |
4527 | "Apply map to routes going into a Route-Server client's table\n" | |
4528 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 4529 | { |
4530 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4531 | bgp_node_safi (vty), argv[1], argv[2]); | |
4532 | } | |
4533 | ||
4534 | DEFUN (no_neighbor_route_map, | |
4535 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 4536 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 4537 | NO_STR |
4538 | NEIGHBOR_STR | |
4539 | NEIGHBOR_ADDR_STR2 | |
4540 | "Apply route map to neighbor\n" | |
4541 | "Name of route map\n" | |
4542 | "Apply map to incoming routes\n" | |
fee0f4c6 | 4543 | "Apply map to outbound routes\n" |
4544 | "Apply map to routes going into a Route-Server client's table\n" | |
4545 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 4546 | { |
4547 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4548 | bgp_node_safi (vty), argv[2]); | |
4549 | } | |
6b0655a2 | 4550 | |
718e3744 | 4551 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 4552 | static int |
fd79ac91 | 4553 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4554 | safi_t safi, const char *name_str) | |
718e3744 | 4555 | { |
4556 | int ret; | |
4557 | struct peer *peer; | |
4558 | ||
4559 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4560 | if (! peer) | |
4561 | return CMD_WARNING; | |
4562 | ||
4563 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
4564 | ||
4565 | return bgp_vty_return (vty, ret); | |
4566 | } | |
4567 | ||
4568 | /* Unset route-map from the peer. */ | |
94f2b392 | 4569 | static int |
fd79ac91 | 4570 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 4571 | safi_t safi) |
4572 | { | |
4573 | int ret; | |
4574 | struct peer *peer; | |
4575 | ||
4576 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4577 | if (! peer) | |
4578 | return CMD_WARNING; | |
4579 | ||
4580 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
4581 | ||
4582 | return bgp_vty_return (vty, ret); | |
4583 | } | |
4584 | ||
4585 | DEFUN (neighbor_unsuppress_map, | |
4586 | neighbor_unsuppress_map_cmd, | |
4587 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
4588 | NEIGHBOR_STR | |
4589 | NEIGHBOR_ADDR_STR2 | |
4590 | "Route-map to selectively unsuppress suppressed routes\n" | |
4591 | "Name of route map\n") | |
4592 | { | |
4593 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4594 | bgp_node_safi (vty), argv[1]); | |
4595 | } | |
4596 | ||
4597 | DEFUN (no_neighbor_unsuppress_map, | |
4598 | no_neighbor_unsuppress_map_cmd, | |
4599 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
4600 | NO_STR | |
4601 | NEIGHBOR_STR | |
4602 | NEIGHBOR_ADDR_STR2 | |
4603 | "Route-map to selectively unsuppress suppressed routes\n" | |
4604 | "Name of route map\n") | |
4605 | { | |
4606 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4607 | bgp_node_safi (vty)); | |
4608 | } | |
6b0655a2 | 4609 | |
94f2b392 | 4610 | static int |
fd79ac91 | 4611 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4612 | safi_t safi, const char *num_str, | |
0a486e5f | 4613 | const char *threshold_str, int warning, |
4614 | const char *restart_str) | |
718e3744 | 4615 | { |
4616 | int ret; | |
4617 | struct peer *peer; | |
4618 | u_int32_t max; | |
e0701b79 | 4619 | u_char threshold; |
0a486e5f | 4620 | u_int16_t restart; |
718e3744 | 4621 | |
4622 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4623 | if (! peer) | |
4624 | return CMD_WARNING; | |
4625 | ||
e6ec1c36 | 4626 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 4627 | if (threshold_str) |
4628 | threshold = atoi (threshold_str); | |
4629 | else | |
4630 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 4631 | |
0a486e5f | 4632 | if (restart_str) |
4633 | restart = atoi (restart_str); | |
4634 | else | |
4635 | restart = 0; | |
4636 | ||
4637 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 4638 | |
4639 | return bgp_vty_return (vty, ret); | |
4640 | } | |
4641 | ||
94f2b392 | 4642 | static int |
fd79ac91 | 4643 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 4644 | safi_t safi) |
4645 | { | |
4646 | int ret; | |
4647 | struct peer *peer; | |
4648 | ||
4649 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4650 | if (! peer) | |
4651 | return CMD_WARNING; | |
4652 | ||
4653 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
4654 | ||
4655 | return bgp_vty_return (vty, ret); | |
4656 | } | |
4657 | ||
4658 | /* Maximum number of prefix configuration. prefix count is different | |
4659 | for each peer configuration. So this configuration can be set for | |
4660 | each peer configuration. */ | |
4661 | DEFUN (neighbor_maximum_prefix, | |
4662 | neighbor_maximum_prefix_cmd, | |
4663 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
4664 | NEIGHBOR_STR | |
4665 | NEIGHBOR_ADDR_STR2 | |
4666 | "Maximum number of prefix accept from this peer\n" | |
4667 | "maximum no. of prefix limit\n") | |
4668 | { | |
4669 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4670 | bgp_node_safi (vty), argv[1], NULL, 0, |
4671 | NULL); | |
718e3744 | 4672 | } |
4673 | ||
e0701b79 | 4674 | DEFUN (neighbor_maximum_prefix_threshold, |
4675 | neighbor_maximum_prefix_threshold_cmd, | |
4676 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
4677 | NEIGHBOR_STR | |
4678 | NEIGHBOR_ADDR_STR2 | |
4679 | "Maximum number of prefix accept from this peer\n" | |
4680 | "maximum no. of prefix limit\n" | |
4681 | "Threshold value (%) at which to generate a warning msg\n") | |
4682 | { | |
4683 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4684 | bgp_node_safi (vty), argv[1], argv[2], 0, |
4685 | NULL); | |
4686 | } | |
e0701b79 | 4687 | |
718e3744 | 4688 | DEFUN (neighbor_maximum_prefix_warning, |
4689 | neighbor_maximum_prefix_warning_cmd, | |
4690 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4691 | NEIGHBOR_STR | |
4692 | NEIGHBOR_ADDR_STR2 | |
4693 | "Maximum number of prefix accept from this peer\n" | |
4694 | "maximum no. of prefix limit\n" | |
4695 | "Only give warning message when limit is exceeded\n") | |
4696 | { | |
4697 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4698 | bgp_node_safi (vty), argv[1], NULL, 1, |
4699 | NULL); | |
718e3744 | 4700 | } |
4701 | ||
e0701b79 | 4702 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
4703 | neighbor_maximum_prefix_threshold_warning_cmd, | |
4704 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
4705 | NEIGHBOR_STR | |
4706 | NEIGHBOR_ADDR_STR2 | |
4707 | "Maximum number of prefix accept from this peer\n" | |
4708 | "maximum no. of prefix limit\n" | |
4709 | "Threshold value (%) at which to generate a warning msg\n" | |
4710 | "Only give warning message when limit is exceeded\n") | |
4711 | { | |
4712 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4713 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
4714 | } | |
4715 | ||
4716 | DEFUN (neighbor_maximum_prefix_restart, | |
4717 | neighbor_maximum_prefix_restart_cmd, | |
4718 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
4719 | NEIGHBOR_STR | |
4720 | NEIGHBOR_ADDR_STR2 | |
4721 | "Maximum number of prefix accept from this peer\n" | |
4722 | "maximum no. of prefix limit\n" | |
4723 | "Restart bgp connection after limit is exceeded\n" | |
4724 | "Restart interval in minutes") | |
4725 | { | |
4726 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4727 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
4728 | } | |
4729 | ||
4730 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
4731 | neighbor_maximum_prefix_threshold_restart_cmd, | |
4732 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
4733 | NEIGHBOR_STR | |
4734 | NEIGHBOR_ADDR_STR2 | |
4735 | "Maximum number of prefix accept from this peer\n" | |
4736 | "maximum no. of prefix limit\n" | |
4737 | "Threshold value (%) at which to generate a warning msg\n" | |
4738 | "Restart bgp connection after limit is exceeded\n" | |
4739 | "Restart interval in minutes") | |
4740 | { | |
4741 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4742 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
4743 | } | |
e0701b79 | 4744 | |
718e3744 | 4745 | DEFUN (no_neighbor_maximum_prefix, |
4746 | no_neighbor_maximum_prefix_cmd, | |
4747 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
4748 | NO_STR | |
4749 | NEIGHBOR_STR | |
4750 | NEIGHBOR_ADDR_STR2 | |
4751 | "Maximum number of prefix accept from this peer\n") | |
4752 | { | |
4753 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4754 | bgp_node_safi (vty)); | |
4755 | } | |
4756 | ||
4757 | ALIAS (no_neighbor_maximum_prefix, | |
4758 | no_neighbor_maximum_prefix_val_cmd, | |
4759 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
4760 | NO_STR | |
4761 | NEIGHBOR_STR | |
4762 | NEIGHBOR_ADDR_STR2 | |
4763 | "Maximum number of prefix accept from this peer\n" | |
4764 | "maximum no. of prefix limit\n") | |
4765 | ||
4766 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 4767 | no_neighbor_maximum_prefix_threshold_cmd, |
4768 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4769 | NO_STR | |
4770 | NEIGHBOR_STR | |
4771 | NEIGHBOR_ADDR_STR2 | |
4772 | "Maximum number of prefix accept from this peer\n" | |
4773 | "maximum no. of prefix limit\n" | |
4774 | "Threshold value (%) at which to generate a warning msg\n") | |
4775 | ||
4776 | ALIAS (no_neighbor_maximum_prefix, | |
4777 | no_neighbor_maximum_prefix_warning_cmd, | |
4778 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4779 | NO_STR | |
4780 | NEIGHBOR_STR | |
4781 | NEIGHBOR_ADDR_STR2 | |
4782 | "Maximum number of prefix accept from this peer\n" | |
4783 | "maximum no. of prefix limit\n" | |
e8e1946e | 4784 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 4785 | |
4786 | ALIAS (no_neighbor_maximum_prefix, | |
4787 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 4788 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
4789 | NO_STR | |
4790 | NEIGHBOR_STR | |
4791 | NEIGHBOR_ADDR_STR2 | |
4792 | "Maximum number of prefix accept from this peer\n" | |
4793 | "maximum no. of prefix limit\n" | |
4794 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 4795 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 4796 | |
4797 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 4798 | no_neighbor_maximum_prefix_restart_cmd, |
4799 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 4800 | NO_STR |
4801 | NEIGHBOR_STR | |
4802 | NEIGHBOR_ADDR_STR2 | |
4803 | "Maximum number of prefix accept from this peer\n" | |
4804 | "maximum no. of prefix limit\n" | |
0a486e5f | 4805 | "Restart bgp connection after limit is exceeded\n" |
4806 | "Restart interval in minutes") | |
4807 | ||
4808 | ALIAS (no_neighbor_maximum_prefix, | |
4809 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
4810 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
4811 | NO_STR | |
4812 | NEIGHBOR_STR | |
4813 | NEIGHBOR_ADDR_STR2 | |
4814 | "Maximum number of prefix accept from this peer\n" | |
4815 | "maximum no. of prefix limit\n" | |
4816 | "Threshold value (%) at which to generate a warning msg\n" | |
4817 | "Restart bgp connection after limit is exceeded\n" | |
4818 | "Restart interval in minutes") | |
6b0655a2 | 4819 | |
718e3744 | 4820 | /* "neighbor allowas-in" */ |
4821 | DEFUN (neighbor_allowas_in, | |
4822 | neighbor_allowas_in_cmd, | |
4823 | NEIGHBOR_CMD2 "allowas-in", | |
4824 | NEIGHBOR_STR | |
4825 | NEIGHBOR_ADDR_STR2 | |
4826 | "Accept as-path with my AS present in it\n") | |
4827 | { | |
4828 | int ret; | |
4829 | struct peer *peer; | |
fd79ac91 | 4830 | unsigned int allow_num; |
718e3744 | 4831 | |
4832 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4833 | if (! peer) | |
4834 | return CMD_WARNING; | |
4835 | ||
4836 | if (argc == 1) | |
4837 | allow_num = 3; | |
4838 | else | |
4839 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
4840 | ||
4841 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
4842 | allow_num); | |
4843 | ||
4844 | return bgp_vty_return (vty, ret); | |
4845 | } | |
4846 | ||
4847 | ALIAS (neighbor_allowas_in, | |
4848 | neighbor_allowas_in_arg_cmd, | |
4849 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
4850 | NEIGHBOR_STR | |
4851 | NEIGHBOR_ADDR_STR2 | |
4852 | "Accept as-path with my AS present in it\n" | |
4853 | "Number of occurances of AS number\n") | |
4854 | ||
4855 | DEFUN (no_neighbor_allowas_in, | |
4856 | no_neighbor_allowas_in_cmd, | |
4857 | NO_NEIGHBOR_CMD2 "allowas-in", | |
4858 | NO_STR | |
4859 | NEIGHBOR_STR | |
4860 | NEIGHBOR_ADDR_STR2 | |
4861 | "allow local ASN appears in aspath attribute\n") | |
4862 | { | |
4863 | int ret; | |
4864 | struct peer *peer; | |
4865 | ||
4866 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4867 | if (! peer) | |
4868 | return CMD_WARNING; | |
4869 | ||
4870 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
4871 | ||
4872 | return bgp_vty_return (vty, ret); | |
4873 | } | |
6b0655a2 | 4874 | |
fa411a21 NH |
4875 | DEFUN (neighbor_ttl_security, |
4876 | neighbor_ttl_security_cmd, | |
4877 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
4878 | NEIGHBOR_STR | |
4879 | NEIGHBOR_ADDR_STR2 | |
4880 | "Specify the maximum number of hops to the BGP peer\n") | |
4881 | { | |
4882 | struct peer *peer; | |
89b6d1f8 | 4883 | int gtsm_hops; |
fa411a21 NH |
4884 | |
4885 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4886 | if (! peer) | |
4887 | return CMD_WARNING; | |
4888 | ||
4889 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
4890 | ||
89b6d1f8 | 4891 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
4892 | } |
4893 | ||
4894 | DEFUN (no_neighbor_ttl_security, | |
4895 | no_neighbor_ttl_security_cmd, | |
4896 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
4897 | NO_STR | |
4898 | NEIGHBOR_STR | |
4899 | NEIGHBOR_ADDR_STR2 | |
4900 | "Specify the maximum number of hops to the BGP peer\n") | |
4901 | { | |
4902 | struct peer *peer; | |
fa411a21 NH |
4903 | |
4904 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4905 | if (! peer) | |
4906 | return CMD_WARNING; | |
4907 | ||
89b6d1f8 | 4908 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 4909 | } |
6b0655a2 | 4910 | |
718e3744 | 4911 | /* Address family configuration. */ |
4912 | DEFUN (address_family_ipv4, | |
4913 | address_family_ipv4_cmd, | |
4914 | "address-family ipv4", | |
4915 | "Enter Address Family command mode\n" | |
4916 | "Address family\n") | |
4917 | { | |
4918 | vty->node = BGP_IPV4_NODE; | |
4919 | return CMD_SUCCESS; | |
4920 | } | |
4921 | ||
4922 | DEFUN (address_family_ipv4_safi, | |
4923 | address_family_ipv4_safi_cmd, | |
4924 | "address-family ipv4 (unicast|multicast)", | |
4925 | "Enter Address Family command mode\n" | |
4926 | "Address family\n" | |
4927 | "Address Family modifier\n" | |
4928 | "Address Family modifier\n") | |
4929 | { | |
4930 | if (strncmp (argv[0], "m", 1) == 0) | |
4931 | vty->node = BGP_IPV4M_NODE; | |
4932 | else | |
4933 | vty->node = BGP_IPV4_NODE; | |
4934 | ||
4935 | return CMD_SUCCESS; | |
4936 | } | |
4937 | ||
25ffbdc1 | 4938 | DEFUN (address_family_ipv6, |
4939 | address_family_ipv6_cmd, | |
4940 | "address-family ipv6", | |
718e3744 | 4941 | "Enter Address Family command mode\n" |
25ffbdc1 | 4942 | "Address family\n") |
718e3744 | 4943 | { |
4944 | vty->node = BGP_IPV6_NODE; | |
4945 | return CMD_SUCCESS; | |
4946 | } | |
4947 | ||
25ffbdc1 | 4948 | DEFUN (address_family_ipv6_safi, |
4949 | address_family_ipv6_safi_cmd, | |
4950 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 4951 | "Enter Address Family command mode\n" |
25ffbdc1 | 4952 | "Address family\n" |
4953 | "Address Family modifier\n" | |
4954 | "Address Family modifier\n") | |
4955 | { | |
4956 | if (strncmp (argv[0], "m", 1) == 0) | |
4957 | vty->node = BGP_IPV6M_NODE; | |
4958 | else | |
4959 | vty->node = BGP_IPV6_NODE; | |
4960 | ||
4961 | return CMD_SUCCESS; | |
4962 | } | |
718e3744 | 4963 | |
4964 | DEFUN (address_family_vpnv4, | |
4965 | address_family_vpnv4_cmd, | |
4966 | "address-family vpnv4", | |
4967 | "Enter Address Family command mode\n" | |
4968 | "Address family\n") | |
4969 | { | |
4970 | vty->node = BGP_VPNV4_NODE; | |
4971 | return CMD_SUCCESS; | |
4972 | } | |
4973 | ||
4974 | ALIAS (address_family_vpnv4, | |
4975 | address_family_vpnv4_unicast_cmd, | |
4976 | "address-family vpnv4 unicast", | |
4977 | "Enter Address Family command mode\n" | |
4978 | "Address family\n" | |
4979 | "Address Family Modifier\n") | |
4980 | ||
4981 | DEFUN (exit_address_family, | |
4982 | exit_address_family_cmd, | |
4983 | "exit-address-family", | |
4984 | "Exit from Address Family configuration mode\n") | |
4985 | { | |
a8a80d53 | 4986 | if (vty->node == BGP_IPV4_NODE |
4987 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 4988 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 4989 | || vty->node == BGP_IPV6_NODE |
4990 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 4991 | vty->node = BGP_NODE; |
4992 | return CMD_SUCCESS; | |
4993 | } | |
6b0655a2 | 4994 | |
718e3744 | 4995 | /* BGP clear sort. */ |
4996 | enum clear_sort | |
4997 | { | |
4998 | clear_all, | |
4999 | clear_peer, | |
5000 | clear_group, | |
5001 | clear_external, | |
5002 | clear_as | |
5003 | }; | |
5004 | ||
94f2b392 | 5005 | static void |
718e3744 | 5006 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
5007 | safi_t safi, int error) | |
5008 | { | |
5009 | switch (error) | |
5010 | { | |
5011 | case BGP_ERR_AF_UNCONFIGURED: | |
5012 | vty_out (vty, | |
5013 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
5014 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
5015 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
5016 | peer->host, VTY_NEWLINE); | |
5017 | break; | |
5018 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
5019 | 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); | |
5020 | break; | |
5021 | default: | |
5022 | break; | |
5023 | } | |
5024 | } | |
5025 | ||
5026 | /* `clear ip bgp' functions. */ | |
94f2b392 | 5027 | static int |
718e3744 | 5028 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
fd79ac91 | 5029 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
718e3744 | 5030 | { |
5031 | int ret; | |
5032 | struct peer *peer; | |
1eb8ef25 | 5033 | struct listnode *node, *nnode; |
718e3744 | 5034 | |
5035 | /* Clear all neighbors. */ | |
1ff9a340 DS |
5036 | /* |
5037 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
5038 | * on the BGP instance as that may get freed if it is a doppelganger | |
5039 | */ | |
718e3744 | 5040 | if (sort == clear_all) |
5041 | { | |
1eb8ef25 | 5042 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 5043 | { |
5044 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5045 | ret = peer_clear (peer, &nnode); |
718e3744 | 5046 | else |
5047 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5048 | ||
5049 | if (ret < 0) | |
5050 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5051 | } | |
f188f2c4 DS |
5052 | |
5053 | /* This is to apply read-only mode on this clear. */ | |
5054 | if (stype == BGP_CLEAR_SOFT_NONE) | |
5055 | bgp->update_delay_over = 0; | |
5056 | ||
0b2aa3a0 | 5057 | return CMD_SUCCESS; |
718e3744 | 5058 | } |
5059 | ||
5060 | /* Clear specified neighbors. */ | |
5061 | if (sort == clear_peer) | |
5062 | { | |
5063 | union sockunion su; | |
5064 | int ret; | |
5065 | ||
5066 | /* Make sockunion for lookup. */ | |
5067 | ret = str2sockunion (arg, &su); | |
5068 | if (ret < 0) | |
a80beece DS |
5069 | { |
5070 | peer = peer_lookup_by_conf_if (bgp, arg); | |
5071 | if (!peer) | |
5072 | { | |
5073 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
5074 | return CMD_WARNING; | |
5075 | } | |
5076 | } | |
5077 | else | |
5078 | { | |
5079 | peer = peer_lookup (bgp, &su); | |
5080 | if (! peer) | |
5081 | { | |
5082 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
5083 | return CMD_WARNING; | |
5084 | } | |
5085 | } | |
718e3744 | 5086 | |
5087 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5088 | ret = peer_clear (peer, NULL); |
718e3744 | 5089 | else |
5090 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5091 | ||
5092 | if (ret < 0) | |
5093 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5094 | ||
0b2aa3a0 | 5095 | return CMD_SUCCESS; |
718e3744 | 5096 | } |
5097 | ||
5098 | /* Clear all peer-group members. */ | |
5099 | if (sort == clear_group) | |
5100 | { | |
5101 | struct peer_group *group; | |
5102 | ||
5103 | group = peer_group_lookup (bgp, arg); | |
5104 | if (! group) | |
5105 | { | |
5106 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 5107 | return CMD_WARNING; |
718e3744 | 5108 | } |
5109 | ||
1eb8ef25 | 5110 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
718e3744 | 5111 | { |
5112 | if (stype == BGP_CLEAR_SOFT_NONE) | |
5113 | { | |
1ff9a340 | 5114 | ret = peer_clear (peer, NULL); |
718e3744 | 5115 | continue; |
5116 | } | |
5117 | ||
5118 | if (! peer->af_group[afi][safi]) | |
5119 | continue; | |
5120 | ||
5121 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5122 | ||
5123 | if (ret < 0) | |
5124 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5125 | } | |
0b2aa3a0 | 5126 | return CMD_SUCCESS; |
718e3744 | 5127 | } |
5128 | ||
5129 | if (sort == clear_external) | |
5130 | { | |
1eb8ef25 | 5131 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 5132 | { |
6d85b15b | 5133 | if (peer->sort == BGP_PEER_IBGP) |
718e3744 | 5134 | continue; |
5135 | ||
5136 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5137 | ret = peer_clear (peer, &nnode); |
718e3744 | 5138 | else |
5139 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5140 | ||
5141 | if (ret < 0) | |
5142 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5143 | } | |
0b2aa3a0 | 5144 | return CMD_SUCCESS; |
718e3744 | 5145 | } |
5146 | ||
5147 | if (sort == clear_as) | |
5148 | { | |
5149 | as_t as; | |
718e3744 | 5150 | int find = 0; |
5151 | ||
bde12e3f | 5152 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
0b2aa3a0 | 5153 | |
1eb8ef25 | 5154 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 5155 | { |
5156 | if (peer->as != as) | |
5157 | continue; | |
5158 | ||
5159 | find = 1; | |
5160 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5161 | ret = peer_clear (peer, &nnode); |
718e3744 | 5162 | else |
5163 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5164 | ||
5165 | if (ret < 0) | |
5166 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5167 | } | |
5168 | if (! find) | |
5169 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
5170 | VTY_NEWLINE); | |
0b2aa3a0 | 5171 | return CMD_SUCCESS; |
718e3744 | 5172 | } |
5173 | ||
0b2aa3a0 | 5174 | return CMD_SUCCESS; |
718e3744 | 5175 | } |
5176 | ||
8ad7271d DS |
5177 | /* Recalculate bestpath and re-advertise a prefix */ |
5178 | static int | |
5179 | bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str, | |
5180 | afi_t afi, safi_t safi, struct prefix_rd *prd) | |
5181 | { | |
5182 | int ret; | |
5183 | struct prefix match; | |
5184 | struct bgp_node *rn; | |
5185 | struct bgp_node *rm; | |
5186 | struct bgp_info *ri; | |
5187 | struct bgp_info *ri_temp; | |
5188 | struct bgp *bgp; | |
5189 | struct bgp_table *table; | |
5190 | struct bgp_table *rib; | |
5191 | ||
5192 | /* BGP structure lookup. */ | |
5193 | if (view_name) | |
5194 | { | |
5195 | bgp = bgp_lookup_by_name (view_name); | |
5196 | if (bgp == NULL) | |
5197 | { | |
5198 | vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE); | |
5199 | return CMD_WARNING; | |
5200 | } | |
5201 | } | |
5202 | else | |
5203 | { | |
5204 | bgp = bgp_get_default (); | |
5205 | if (bgp == NULL) | |
5206 | { | |
5207 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
5208 | return CMD_WARNING; | |
5209 | } | |
5210 | } | |
5211 | ||
5212 | /* Check IP address argument. */ | |
5213 | ret = str2prefix (ip_str, &match); | |
5214 | if (! ret) | |
5215 | { | |
5216 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
5217 | return CMD_WARNING; | |
5218 | } | |
5219 | ||
5220 | match.family = afi2family (afi); | |
5221 | rib = bgp->rib[afi][safi]; | |
5222 | ||
5223 | if (safi == SAFI_MPLS_VPN) | |
5224 | { | |
5225 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
5226 | { | |
5227 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
5228 | continue; | |
5229 | ||
5230 | if ((table = rn->info) != NULL) | |
5231 | { | |
5232 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
5233 | { | |
5234 | if (rm->p.prefixlen == match.prefixlen) | |
5235 | { | |
5236 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5237 | bgp_process (bgp, rm, afi, safi); | |
5238 | } | |
5239 | bgp_unlock_node (rm); | |
5240 | } | |
5241 | } | |
5242 | } | |
5243 | } | |
5244 | else | |
5245 | { | |
5246 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
5247 | { | |
5248 | if (rn->p.prefixlen == match.prefixlen) | |
5249 | { | |
5250 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5251 | bgp_process (bgp, rn, afi, safi); | |
5252 | } | |
5253 | bgp_unlock_node (rn); | |
5254 | } | |
5255 | } | |
5256 | ||
5257 | return CMD_SUCCESS; | |
5258 | } | |
5259 | ||
94f2b392 | 5260 | static int |
fd79ac91 | 5261 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
5262 | enum clear_sort sort, enum bgp_clear_type stype, | |
5263 | const char *arg) | |
718e3744 | 5264 | { |
718e3744 | 5265 | struct bgp *bgp; |
5266 | ||
5267 | /* BGP structure lookup. */ | |
5268 | if (name) | |
5269 | { | |
5270 | bgp = bgp_lookup_by_name (name); | |
5271 | if (bgp == NULL) | |
5272 | { | |
5273 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
5274 | return CMD_WARNING; | |
5275 | } | |
5276 | } | |
5277 | else | |
5278 | { | |
5279 | bgp = bgp_get_default (); | |
5280 | if (bgp == NULL) | |
5281 | { | |
5282 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
5283 | return CMD_WARNING; | |
5284 | } | |
5285 | } | |
5286 | ||
0b2aa3a0 | 5287 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
718e3744 | 5288 | } |
5289 | ||
5290 | DEFUN (clear_ip_bgp_all, | |
5291 | clear_ip_bgp_all_cmd, | |
5292 | "clear ip bgp *", | |
5293 | CLEAR_STR | |
5294 | IP_STR | |
5295 | BGP_STR | |
5296 | "Clear all peers\n") | |
5297 | { | |
5298 | if (argc == 1) | |
5299 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5300 | ||
5301 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5302 | } | |
5303 | ||
5304 | ALIAS (clear_ip_bgp_all, | |
5305 | clear_bgp_all_cmd, | |
5306 | "clear bgp *", | |
5307 | CLEAR_STR | |
5308 | BGP_STR | |
5309 | "Clear all peers\n") | |
5310 | ||
5311 | ALIAS (clear_ip_bgp_all, | |
5312 | clear_bgp_ipv6_all_cmd, | |
5313 | "clear bgp ipv6 *", | |
5314 | CLEAR_STR | |
5315 | BGP_STR | |
5316 | "Address family\n" | |
5317 | "Clear all peers\n") | |
5318 | ||
5319 | ALIAS (clear_ip_bgp_all, | |
5320 | clear_ip_bgp_instance_all_cmd, | |
5321 | "clear ip bgp view WORD *", | |
5322 | CLEAR_STR | |
5323 | IP_STR | |
5324 | BGP_STR | |
5325 | "BGP view\n" | |
5326 | "view name\n" | |
5327 | "Clear all peers\n") | |
5328 | ||
5329 | ALIAS (clear_ip_bgp_all, | |
5330 | clear_bgp_instance_all_cmd, | |
5331 | "clear bgp view WORD *", | |
5332 | CLEAR_STR | |
5333 | BGP_STR | |
5334 | "BGP view\n" | |
5335 | "view name\n" | |
5336 | "Clear all peers\n") | |
5337 | ||
5338 | DEFUN (clear_ip_bgp_peer, | |
5339 | clear_ip_bgp_peer_cmd, | |
a80beece | 5340 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5341 | CLEAR_STR |
5342 | IP_STR | |
5343 | BGP_STR | |
5344 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
5345 | "BGP IPv6 neighbor to clear\n" |
5346 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5347 | { |
5348 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5349 | } | |
5350 | ||
5351 | ALIAS (clear_ip_bgp_peer, | |
5352 | clear_bgp_peer_cmd, | |
a80beece | 5353 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5354 | CLEAR_STR |
5355 | BGP_STR | |
5356 | "BGP neighbor address to clear\n" | |
a80beece DS |
5357 | "BGP IPv6 neighbor to clear\n" |
5358 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5359 | |
5360 | ALIAS (clear_ip_bgp_peer, | |
5361 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 5362 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5363 | CLEAR_STR |
5364 | BGP_STR | |
5365 | "Address family\n" | |
5366 | "BGP neighbor address to clear\n" | |
a80beece DS |
5367 | "BGP IPv6 neighbor to clear\n" |
5368 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5369 | |
5370 | DEFUN (clear_ip_bgp_peer_group, | |
5371 | clear_ip_bgp_peer_group_cmd, | |
5372 | "clear ip bgp peer-group WORD", | |
5373 | CLEAR_STR | |
5374 | IP_STR | |
5375 | BGP_STR | |
5376 | "Clear all members of peer-group\n" | |
5377 | "BGP peer-group name\n") | |
5378 | { | |
5379 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5380 | } | |
5381 | ||
5382 | ALIAS (clear_ip_bgp_peer_group, | |
5383 | clear_bgp_peer_group_cmd, | |
5384 | "clear bgp peer-group WORD", | |
5385 | CLEAR_STR | |
5386 | BGP_STR | |
5387 | "Clear all members of peer-group\n" | |
5388 | "BGP peer-group name\n") | |
5389 | ||
5390 | ALIAS (clear_ip_bgp_peer_group, | |
5391 | clear_bgp_ipv6_peer_group_cmd, | |
5392 | "clear bgp ipv6 peer-group WORD", | |
5393 | CLEAR_STR | |
5394 | BGP_STR | |
5395 | "Address family\n" | |
5396 | "Clear all members of peer-group\n" | |
5397 | "BGP peer-group name\n") | |
5398 | ||
5399 | DEFUN (clear_ip_bgp_external, | |
5400 | clear_ip_bgp_external_cmd, | |
5401 | "clear ip bgp external", | |
5402 | CLEAR_STR | |
5403 | IP_STR | |
5404 | BGP_STR | |
5405 | "Clear all external peers\n") | |
5406 | { | |
5407 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
5408 | } | |
5409 | ||
5410 | ALIAS (clear_ip_bgp_external, | |
5411 | clear_bgp_external_cmd, | |
5412 | "clear bgp external", | |
5413 | CLEAR_STR | |
5414 | BGP_STR | |
5415 | "Clear all external peers\n") | |
5416 | ||
5417 | ALIAS (clear_ip_bgp_external, | |
5418 | clear_bgp_ipv6_external_cmd, | |
5419 | "clear bgp ipv6 external", | |
5420 | CLEAR_STR | |
5421 | BGP_STR | |
5422 | "Address family\n" | |
5423 | "Clear all external peers\n") | |
5424 | ||
8ad7271d DS |
5425 | DEFUN (clear_ip_bgp_prefix, |
5426 | clear_ip_bgp_prefix_cmd, | |
5427 | "clear ip bgp prefix A.B.C.D/M", | |
5428 | CLEAR_STR | |
5429 | IP_STR | |
5430 | BGP_STR | |
5431 | "Clear bestpath and re-advertise\n" | |
5432 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5433 | { | |
5434 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); | |
5435 | } | |
5436 | ||
5437 | ALIAS (clear_ip_bgp_prefix, | |
5438 | clear_bgp_prefix_cmd, | |
5439 | "clear bgp prefix A.B.C.D/M", | |
5440 | CLEAR_STR | |
5441 | BGP_STR | |
5442 | "Clear bestpath and re-advertise\n" | |
5443 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5444 | ||
5445 | ||
718e3744 | 5446 | DEFUN (clear_ip_bgp_as, |
5447 | clear_ip_bgp_as_cmd, | |
320da874 | 5448 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 5449 | CLEAR_STR |
5450 | IP_STR | |
5451 | BGP_STR | |
5452 | "Clear peers with the AS number\n") | |
5453 | { | |
5454 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5455 | } | |
5456 | ||
5457 | ALIAS (clear_ip_bgp_as, | |
5458 | clear_bgp_as_cmd, | |
320da874 | 5459 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 5460 | CLEAR_STR |
5461 | BGP_STR | |
5462 | "Clear peers with the AS number\n") | |
5463 | ||
5464 | ALIAS (clear_ip_bgp_as, | |
5465 | clear_bgp_ipv6_as_cmd, | |
320da874 | 5466 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 5467 | CLEAR_STR |
5468 | BGP_STR | |
5469 | "Address family\n" | |
5470 | "Clear peers with the AS number\n") | |
6b0655a2 | 5471 | |
718e3744 | 5472 | /* Outbound soft-reconfiguration */ |
5473 | DEFUN (clear_ip_bgp_all_soft_out, | |
5474 | clear_ip_bgp_all_soft_out_cmd, | |
5475 | "clear ip bgp * soft out", | |
5476 | CLEAR_STR | |
5477 | IP_STR | |
5478 | BGP_STR | |
5479 | "Clear all peers\n" | |
e0bce756 DS |
5480 | BGP_SOFT_STR |
5481 | BGP_SOFT_OUT_STR) | |
718e3744 | 5482 | { |
5483 | if (argc == 1) | |
5484 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5485 | BGP_CLEAR_SOFT_OUT, NULL); | |
5486 | ||
5487 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5488 | BGP_CLEAR_SOFT_OUT, NULL); | |
5489 | } | |
5490 | ||
5491 | ALIAS (clear_ip_bgp_all_soft_out, | |
5492 | clear_ip_bgp_all_out_cmd, | |
5493 | "clear ip bgp * out", | |
5494 | CLEAR_STR | |
5495 | IP_STR | |
5496 | BGP_STR | |
5497 | "Clear all peers\n" | |
e0bce756 | 5498 | BGP_SOFT_OUT_STR) |
718e3744 | 5499 | |
5500 | ALIAS (clear_ip_bgp_all_soft_out, | |
5501 | clear_ip_bgp_instance_all_soft_out_cmd, | |
5502 | "clear ip bgp view WORD * soft out", | |
5503 | CLEAR_STR | |
5504 | IP_STR | |
5505 | BGP_STR | |
5506 | "BGP view\n" | |
5507 | "view name\n" | |
5508 | "Clear all peers\n" | |
e0bce756 DS |
5509 | BGP_SOFT_STR |
5510 | BGP_SOFT_OUT_STR) | |
718e3744 | 5511 | |
5512 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
5513 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
5514 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
5515 | CLEAR_STR | |
5516 | IP_STR | |
5517 | BGP_STR | |
5518 | "Clear all peers\n" | |
5519 | "Address family\n" | |
5520 | "Address Family modifier\n" | |
5521 | "Address Family modifier\n" | |
e0bce756 DS |
5522 | BGP_SOFT_STR |
5523 | BGP_SOFT_OUT_STR) | |
718e3744 | 5524 | { |
5525 | if (strncmp (argv[0], "m", 1) == 0) | |
5526 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5527 | BGP_CLEAR_SOFT_OUT, NULL); | |
5528 | ||
5529 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5530 | BGP_CLEAR_SOFT_OUT, NULL); | |
5531 | } | |
5532 | ||
5533 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
5534 | clear_ip_bgp_all_ipv4_out_cmd, | |
5535 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
5536 | CLEAR_STR | |
5537 | IP_STR | |
5538 | BGP_STR | |
5539 | "Clear all peers\n" | |
5540 | "Address family\n" | |
5541 | "Address Family modifier\n" | |
5542 | "Address Family modifier\n" | |
e0bce756 | 5543 | BGP_SOFT_OUT_STR) |
718e3744 | 5544 | |
5545 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
5546 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
5547 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
5548 | CLEAR_STR | |
5549 | IP_STR | |
5550 | BGP_STR | |
5551 | "BGP view\n" | |
5552 | "view name\n" | |
5553 | "Clear all peers\n" | |
5554 | "Address family\n" | |
5555 | "Address Family modifier\n" | |
5556 | "Address Family modifier\n" | |
e0bce756 | 5557 | BGP_SOFT_OUT_STR) |
718e3744 | 5558 | { |
5559 | if (strncmp (argv[1], "m", 1) == 0) | |
5560 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5561 | BGP_CLEAR_SOFT_OUT, NULL); | |
5562 | ||
5563 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5564 | BGP_CLEAR_SOFT_OUT, NULL); | |
5565 | } | |
5566 | ||
5567 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
5568 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
5569 | "clear ip bgp * vpnv4 unicast soft out", | |
5570 | CLEAR_STR | |
5571 | IP_STR | |
5572 | BGP_STR | |
5573 | "Clear all peers\n" | |
5574 | "Address family\n" | |
5575 | "Address Family Modifier\n" | |
e0bce756 DS |
5576 | BGP_SOFT_STR |
5577 | BGP_SOFT_OUT_STR) | |
718e3744 | 5578 | { |
5579 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5580 | BGP_CLEAR_SOFT_OUT, NULL); | |
5581 | } | |
5582 | ||
5583 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
5584 | clear_ip_bgp_all_vpnv4_out_cmd, | |
5585 | "clear ip bgp * vpnv4 unicast out", | |
5586 | CLEAR_STR | |
5587 | IP_STR | |
5588 | BGP_STR | |
5589 | "Clear all peers\n" | |
5590 | "Address family\n" | |
5591 | "Address Family Modifier\n" | |
e0bce756 | 5592 | BGP_SOFT_OUT_STR) |
718e3744 | 5593 | |
5594 | DEFUN (clear_bgp_all_soft_out, | |
5595 | clear_bgp_all_soft_out_cmd, | |
5596 | "clear bgp * soft out", | |
5597 | CLEAR_STR | |
5598 | BGP_STR | |
5599 | "Clear all peers\n" | |
e0bce756 DS |
5600 | BGP_SOFT_STR |
5601 | BGP_SOFT_OUT_STR) | |
718e3744 | 5602 | { |
5603 | if (argc == 1) | |
5604 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5605 | BGP_CLEAR_SOFT_OUT, NULL); | |
5606 | ||
5607 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5608 | BGP_CLEAR_SOFT_OUT, NULL); | |
5609 | } | |
5610 | ||
5611 | ALIAS (clear_bgp_all_soft_out, | |
5612 | clear_bgp_instance_all_soft_out_cmd, | |
5613 | "clear bgp view WORD * soft out", | |
5614 | CLEAR_STR | |
5615 | BGP_STR | |
5616 | "BGP view\n" | |
5617 | "view name\n" | |
5618 | "Clear all peers\n" | |
e0bce756 DS |
5619 | BGP_SOFT_STR |
5620 | BGP_SOFT_OUT_STR) | |
718e3744 | 5621 | |
5622 | ALIAS (clear_bgp_all_soft_out, | |
5623 | clear_bgp_all_out_cmd, | |
5624 | "clear bgp * out", | |
5625 | CLEAR_STR | |
5626 | BGP_STR | |
5627 | "Clear all peers\n" | |
e0bce756 | 5628 | BGP_SOFT_OUT_STR) |
718e3744 | 5629 | |
5630 | ALIAS (clear_bgp_all_soft_out, | |
5631 | clear_bgp_ipv6_all_soft_out_cmd, | |
5632 | "clear bgp ipv6 * soft out", | |
5633 | CLEAR_STR | |
5634 | BGP_STR | |
5635 | "Address family\n" | |
5636 | "Clear all peers\n" | |
e0bce756 DS |
5637 | BGP_SOFT_STR |
5638 | BGP_SOFT_OUT_STR) | |
718e3744 | 5639 | |
5640 | ALIAS (clear_bgp_all_soft_out, | |
5641 | clear_bgp_ipv6_all_out_cmd, | |
5642 | "clear bgp ipv6 * out", | |
5643 | CLEAR_STR | |
5644 | BGP_STR | |
5645 | "Address family\n" | |
5646 | "Clear all peers\n" | |
e0bce756 | 5647 | BGP_SOFT_OUT_STR) |
718e3744 | 5648 | |
8ad7271d DS |
5649 | DEFUN (clear_bgp_ipv6_safi_prefix, |
5650 | clear_bgp_ipv6_safi_prefix_cmd, | |
5651 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
5652 | CLEAR_STR | |
5653 | BGP_STR | |
5654 | "Address family\n" | |
5655 | "Address Family Modifier\n" | |
5656 | "Clear bestpath and re-advertise\n" | |
5657 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
5658 | { | |
5659 | if (strncmp (argv[0], "m", 1) == 0) | |
5660 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
5661 | else | |
5662 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
5663 | } | |
5664 | ||
718e3744 | 5665 | DEFUN (clear_ip_bgp_peer_soft_out, |
5666 | clear_ip_bgp_peer_soft_out_cmd, | |
5667 | "clear ip bgp A.B.C.D soft out", | |
5668 | CLEAR_STR | |
5669 | IP_STR | |
5670 | BGP_STR | |
5671 | "BGP neighbor address to clear\n" | |
e0bce756 DS |
5672 | BGP_SOFT_STR |
5673 | BGP_SOFT_OUT_STR) | |
718e3744 | 5674 | { |
5675 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5676 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5677 | } | |
5678 | ||
5679 | ALIAS (clear_ip_bgp_peer_soft_out, | |
5680 | clear_ip_bgp_peer_out_cmd, | |
5681 | "clear ip bgp A.B.C.D out", | |
5682 | CLEAR_STR | |
5683 | IP_STR | |
5684 | BGP_STR | |
5685 | "BGP neighbor address to clear\n" | |
e0bce756 | 5686 | BGP_SOFT_OUT_STR) |
718e3744 | 5687 | |
5688 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
5689 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
5690 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", | |
5691 | CLEAR_STR | |
5692 | IP_STR | |
5693 | BGP_STR | |
5694 | "BGP neighbor address to clear\n" | |
5695 | "Address family\n" | |
5696 | "Address Family modifier\n" | |
5697 | "Address Family modifier\n" | |
e0bce756 DS |
5698 | BGP_SOFT_STR |
5699 | BGP_SOFT_OUT_STR) | |
718e3744 | 5700 | { |
5701 | if (strncmp (argv[1], "m", 1) == 0) | |
5702 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5703 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5704 | ||
5705 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5706 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5707 | } | |
5708 | ||
5709 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
5710 | clear_ip_bgp_peer_ipv4_out_cmd, | |
5711 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", | |
5712 | CLEAR_STR | |
5713 | IP_STR | |
5714 | BGP_STR | |
5715 | "BGP neighbor address to clear\n" | |
5716 | "Address family\n" | |
5717 | "Address Family modifier\n" | |
5718 | "Address Family modifier\n" | |
e0bce756 | 5719 | BGP_SOFT_OUT_STR) |
718e3744 | 5720 | |
5721 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, | |
5722 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
5723 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", | |
5724 | CLEAR_STR | |
5725 | IP_STR | |
5726 | BGP_STR | |
5727 | "BGP neighbor address to clear\n" | |
5728 | "Address family\n" | |
5729 | "Address Family Modifier\n" | |
e0bce756 DS |
5730 | BGP_SOFT_STR |
5731 | BGP_SOFT_OUT_STR) | |
718e3744 | 5732 | { |
5733 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5734 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5735 | } | |
5736 | ||
5737 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
5738 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
5739 | "clear ip bgp A.B.C.D vpnv4 unicast out", | |
5740 | CLEAR_STR | |
5741 | IP_STR | |
5742 | BGP_STR | |
5743 | "BGP neighbor address to clear\n" | |
5744 | "Address family\n" | |
5745 | "Address Family Modifier\n" | |
e0bce756 | 5746 | BGP_SOFT_OUT_STR) |
718e3744 | 5747 | |
5748 | DEFUN (clear_bgp_peer_soft_out, | |
5749 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 5750 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 5751 | CLEAR_STR |
5752 | BGP_STR | |
5753 | "BGP neighbor address to clear\n" | |
5754 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5755 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
5756 | BGP_SOFT_STR |
5757 | BGP_SOFT_OUT_STR) | |
718e3744 | 5758 | { |
5759 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5760 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5761 | } | |
5762 | ||
5763 | ALIAS (clear_bgp_peer_soft_out, | |
5764 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 5765 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 5766 | CLEAR_STR |
5767 | BGP_STR | |
5768 | "Address family\n" | |
5769 | "BGP neighbor address to clear\n" | |
5770 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5771 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
5772 | BGP_SOFT_STR |
5773 | BGP_SOFT_OUT_STR) | |
718e3744 | 5774 | |
5775 | ALIAS (clear_bgp_peer_soft_out, | |
5776 | clear_bgp_peer_out_cmd, | |
a80beece | 5777 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 5778 | CLEAR_STR |
5779 | BGP_STR | |
5780 | "BGP neighbor address to clear\n" | |
5781 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5782 | "BGP neighbor on interface to clear\n" |
e0bce756 | 5783 | BGP_SOFT_OUT_STR) |
718e3744 | 5784 | |
5785 | ALIAS (clear_bgp_peer_soft_out, | |
5786 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 5787 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 5788 | CLEAR_STR |
5789 | BGP_STR | |
5790 | "Address family\n" | |
5791 | "BGP neighbor address to clear\n" | |
5792 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5793 | "BGP neighbor on interface to clear\n" |
e0bce756 | 5794 | BGP_SOFT_OUT_STR) |
718e3744 | 5795 | |
5796 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
5797 | clear_ip_bgp_peer_group_soft_out_cmd, | |
5798 | "clear ip bgp peer-group WORD soft out", | |
5799 | CLEAR_STR | |
5800 | IP_STR | |
5801 | BGP_STR | |
5802 | "Clear all members of peer-group\n" | |
5803 | "BGP peer-group name\n" | |
e0bce756 DS |
5804 | BGP_SOFT_STR |
5805 | BGP_SOFT_OUT_STR) | |
718e3744 | 5806 | { |
5807 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5808 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5809 | } | |
5810 | ||
5811 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
5812 | clear_ip_bgp_peer_group_out_cmd, | |
5813 | "clear ip bgp peer-group WORD out", | |
5814 | CLEAR_STR | |
5815 | IP_STR | |
5816 | BGP_STR | |
5817 | "Clear all members of peer-group\n" | |
5818 | "BGP peer-group name\n" | |
e0bce756 | 5819 | BGP_SOFT_OUT_STR) |
718e3744 | 5820 | |
5821 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
5822 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
5823 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
5824 | CLEAR_STR | |
5825 | IP_STR | |
5826 | BGP_STR | |
5827 | "Clear all members of peer-group\n" | |
5828 | "BGP peer-group name\n" | |
5829 | "Address family\n" | |
5830 | "Address Family modifier\n" | |
5831 | "Address Family modifier\n" | |
e0bce756 DS |
5832 | BGP_SOFT_STR |
5833 | BGP_SOFT_OUT_STR) | |
718e3744 | 5834 | { |
5835 | if (strncmp (argv[1], "m", 1) == 0) | |
5836 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5837 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5838 | ||
5839 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5840 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5841 | } | |
5842 | ||
5843 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
5844 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
5845 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
5846 | CLEAR_STR | |
5847 | IP_STR | |
5848 | BGP_STR | |
5849 | "Clear all members of peer-group\n" | |
5850 | "BGP peer-group name\n" | |
5851 | "Address family\n" | |
5852 | "Address Family modifier\n" | |
5853 | "Address Family modifier\n" | |
e0bce756 | 5854 | BGP_SOFT_OUT_STR) |
718e3744 | 5855 | |
5856 | DEFUN (clear_bgp_peer_group_soft_out, | |
5857 | clear_bgp_peer_group_soft_out_cmd, | |
5858 | "clear bgp peer-group WORD soft out", | |
5859 | CLEAR_STR | |
5860 | BGP_STR | |
5861 | "Clear all members of peer-group\n" | |
5862 | "BGP peer-group name\n" | |
e0bce756 DS |
5863 | BGP_SOFT_STR |
5864 | BGP_SOFT_OUT_STR) | |
718e3744 | 5865 | { |
5866 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5867 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5868 | } | |
5869 | ||
5870 | ALIAS (clear_bgp_peer_group_soft_out, | |
5871 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
5872 | "clear bgp ipv6 peer-group WORD soft out", | |
5873 | CLEAR_STR | |
5874 | BGP_STR | |
5875 | "Address family\n" | |
5876 | "Clear all members of peer-group\n" | |
5877 | "BGP peer-group name\n" | |
e0bce756 DS |
5878 | BGP_SOFT_STR |
5879 | BGP_SOFT_OUT_STR) | |
718e3744 | 5880 | |
5881 | ALIAS (clear_bgp_peer_group_soft_out, | |
5882 | clear_bgp_peer_group_out_cmd, | |
5883 | "clear bgp peer-group WORD out", | |
5884 | CLEAR_STR | |
5885 | BGP_STR | |
5886 | "Clear all members of peer-group\n" | |
5887 | "BGP peer-group name\n" | |
e0bce756 | 5888 | BGP_SOFT_OUT_STR) |
718e3744 | 5889 | |
5890 | ALIAS (clear_bgp_peer_group_soft_out, | |
5891 | clear_bgp_ipv6_peer_group_out_cmd, | |
5892 | "clear bgp ipv6 peer-group WORD out", | |
5893 | CLEAR_STR | |
5894 | BGP_STR | |
5895 | "Address family\n" | |
5896 | "Clear all members of peer-group\n" | |
5897 | "BGP peer-group name\n" | |
e0bce756 | 5898 | BGP_SOFT_OUT_STR) |
718e3744 | 5899 | |
5900 | DEFUN (clear_ip_bgp_external_soft_out, | |
5901 | clear_ip_bgp_external_soft_out_cmd, | |
5902 | "clear ip bgp external soft out", | |
5903 | CLEAR_STR | |
5904 | IP_STR | |
5905 | BGP_STR | |
5906 | "Clear all external peers\n" | |
e0bce756 DS |
5907 | BGP_SOFT_STR |
5908 | BGP_SOFT_OUT_STR) | |
718e3744 | 5909 | { |
5910 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5911 | BGP_CLEAR_SOFT_OUT, NULL); | |
5912 | } | |
5913 | ||
5914 | ALIAS (clear_ip_bgp_external_soft_out, | |
5915 | clear_ip_bgp_external_out_cmd, | |
5916 | "clear ip bgp external out", | |
5917 | CLEAR_STR | |
5918 | IP_STR | |
5919 | BGP_STR | |
5920 | "Clear all external peers\n" | |
e0bce756 | 5921 | BGP_SOFT_OUT_STR) |
718e3744 | 5922 | |
5923 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
5924 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
5925 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
5926 | CLEAR_STR | |
5927 | IP_STR | |
5928 | BGP_STR | |
5929 | "Clear all external peers\n" | |
5930 | "Address family\n" | |
5931 | "Address Family modifier\n" | |
5932 | "Address Family modifier\n" | |
e0bce756 DS |
5933 | BGP_SOFT_STR |
5934 | BGP_SOFT_OUT_STR) | |
718e3744 | 5935 | { |
5936 | if (strncmp (argv[0], "m", 1) == 0) | |
5937 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
5938 | BGP_CLEAR_SOFT_OUT, NULL); | |
5939 | ||
5940 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5941 | BGP_CLEAR_SOFT_OUT, NULL); | |
5942 | } | |
5943 | ||
5944 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
5945 | clear_ip_bgp_external_ipv4_out_cmd, | |
5946 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
5947 | CLEAR_STR | |
5948 | IP_STR | |
5949 | BGP_STR | |
5950 | "Clear all external peers\n" | |
5951 | "Address family\n" | |
5952 | "Address Family modifier\n" | |
5953 | "Address Family modifier\n" | |
e0bce756 | 5954 | BGP_SOFT_OUT_STR) |
718e3744 | 5955 | |
5956 | DEFUN (clear_bgp_external_soft_out, | |
5957 | clear_bgp_external_soft_out_cmd, | |
5958 | "clear bgp external soft out", | |
5959 | CLEAR_STR | |
5960 | BGP_STR | |
5961 | "Clear all external peers\n" | |
e0bce756 DS |
5962 | BGP_SOFT_STR |
5963 | BGP_SOFT_OUT_STR) | |
718e3744 | 5964 | { |
5965 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
5966 | BGP_CLEAR_SOFT_OUT, NULL); | |
5967 | } | |
5968 | ||
5969 | ALIAS (clear_bgp_external_soft_out, | |
5970 | clear_bgp_ipv6_external_soft_out_cmd, | |
5971 | "clear bgp ipv6 external soft out", | |
5972 | CLEAR_STR | |
5973 | BGP_STR | |
5974 | "Address family\n" | |
5975 | "Clear all external peers\n" | |
e0bce756 DS |
5976 | BGP_SOFT_STR |
5977 | BGP_SOFT_OUT_STR) | |
718e3744 | 5978 | |
5979 | ALIAS (clear_bgp_external_soft_out, | |
5980 | clear_bgp_external_out_cmd, | |
5981 | "clear bgp external out", | |
5982 | CLEAR_STR | |
5983 | BGP_STR | |
5984 | "Clear all external peers\n" | |
e0bce756 | 5985 | BGP_SOFT_OUT_STR) |
718e3744 | 5986 | |
5987 | ALIAS (clear_bgp_external_soft_out, | |
5988 | clear_bgp_ipv6_external_out_cmd, | |
5989 | "clear bgp ipv6 external WORD out", | |
5990 | CLEAR_STR | |
5991 | BGP_STR | |
5992 | "Address family\n" | |
5993 | "Clear all external peers\n" | |
e0bce756 | 5994 | BGP_SOFT_OUT_STR) |
718e3744 | 5995 | |
5996 | DEFUN (clear_ip_bgp_as_soft_out, | |
5997 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 5998 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 5999 | CLEAR_STR |
6000 | IP_STR | |
6001 | BGP_STR | |
6002 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6003 | BGP_SOFT_STR |
6004 | BGP_SOFT_OUT_STR) | |
718e3744 | 6005 | { |
6006 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6007 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6008 | } | |
6009 | ||
6010 | ALIAS (clear_ip_bgp_as_soft_out, | |
6011 | clear_ip_bgp_as_out_cmd, | |
320da874 | 6012 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 6013 | CLEAR_STR |
6014 | IP_STR | |
6015 | BGP_STR | |
6016 | "Clear peers with the AS number\n" | |
e0bce756 | 6017 | BGP_SOFT_OUT_STR) |
718e3744 | 6018 | |
6019 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
6020 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 6021 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 6022 | CLEAR_STR |
6023 | IP_STR | |
6024 | BGP_STR | |
6025 | "Clear peers with the AS number\n" | |
6026 | "Address family\n" | |
6027 | "Address Family modifier\n" | |
6028 | "Address Family modifier\n" | |
e0bce756 DS |
6029 | BGP_SOFT_STR |
6030 | BGP_SOFT_OUT_STR) | |
718e3744 | 6031 | { |
6032 | if (strncmp (argv[1], "m", 1) == 0) | |
6033 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6034 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6035 | ||
6036 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6037 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6038 | } | |
6039 | ||
6040 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
6041 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 6042 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 6043 | CLEAR_STR |
6044 | IP_STR | |
6045 | BGP_STR | |
6046 | "Clear peers with the AS number\n" | |
6047 | "Address family\n" | |
6048 | "Address Family modifier\n" | |
6049 | "Address Family modifier\n" | |
e0bce756 | 6050 | BGP_SOFT_OUT_STR) |
718e3744 | 6051 | |
6052 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
6053 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 6054 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 6055 | CLEAR_STR |
6056 | IP_STR | |
6057 | BGP_STR | |
6058 | "Clear peers with the AS number\n" | |
6059 | "Address family\n" | |
6060 | "Address Family modifier\n" | |
e0bce756 DS |
6061 | BGP_SOFT_STR |
6062 | BGP_SOFT_OUT_STR) | |
718e3744 | 6063 | { |
6064 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6065 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6066 | } | |
6067 | ||
6068 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
6069 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 6070 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 6071 | CLEAR_STR |
6072 | IP_STR | |
6073 | BGP_STR | |
6074 | "Clear peers with the AS number\n" | |
6075 | "Address family\n" | |
6076 | "Address Family modifier\n" | |
e0bce756 | 6077 | BGP_SOFT_OUT_STR) |
718e3744 | 6078 | |
6079 | DEFUN (clear_bgp_as_soft_out, | |
6080 | clear_bgp_as_soft_out_cmd, | |
320da874 | 6081 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6082 | CLEAR_STR |
6083 | BGP_STR | |
6084 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6085 | BGP_SOFT_STR |
6086 | BGP_SOFT_OUT_STR) | |
718e3744 | 6087 | { |
6088 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6089 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6090 | } | |
6091 | ||
6092 | ALIAS (clear_bgp_as_soft_out, | |
6093 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 6094 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 6095 | CLEAR_STR |
6096 | BGP_STR | |
6097 | "Address family\n" | |
6098 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6099 | BGP_SOFT_STR |
6100 | BGP_SOFT_OUT_STR) | |
718e3744 | 6101 | |
6102 | ALIAS (clear_bgp_as_soft_out, | |
6103 | clear_bgp_as_out_cmd, | |
320da874 | 6104 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 6105 | CLEAR_STR |
6106 | BGP_STR | |
6107 | "Clear peers with the AS number\n" | |
e0bce756 | 6108 | BGP_SOFT_OUT_STR) |
718e3744 | 6109 | |
6110 | ALIAS (clear_bgp_as_soft_out, | |
6111 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 6112 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 6113 | CLEAR_STR |
6114 | BGP_STR | |
6115 | "Address family\n" | |
6116 | "Clear peers with the AS number\n" | |
e0bce756 | 6117 | BGP_SOFT_OUT_STR) |
6b0655a2 | 6118 | |
718e3744 | 6119 | /* Inbound soft-reconfiguration */ |
6120 | DEFUN (clear_ip_bgp_all_soft_in, | |
6121 | clear_ip_bgp_all_soft_in_cmd, | |
6122 | "clear ip bgp * soft in", | |
6123 | CLEAR_STR | |
6124 | IP_STR | |
6125 | BGP_STR | |
6126 | "Clear all peers\n" | |
e0bce756 DS |
6127 | BGP_SOFT_STR |
6128 | BGP_SOFT_IN_STR) | |
718e3744 | 6129 | { |
6130 | if (argc == 1) | |
6131 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6132 | BGP_CLEAR_SOFT_IN, NULL); | |
6133 | ||
6134 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6135 | BGP_CLEAR_SOFT_IN, NULL); | |
6136 | } | |
6137 | ||
6138 | ALIAS (clear_ip_bgp_all_soft_in, | |
6139 | clear_ip_bgp_instance_all_soft_in_cmd, | |
6140 | "clear ip bgp view WORD * soft in", | |
6141 | CLEAR_STR | |
6142 | IP_STR | |
6143 | BGP_STR | |
6144 | "BGP view\n" | |
6145 | "view name\n" | |
6146 | "Clear all peers\n" | |
e0bce756 DS |
6147 | BGP_SOFT_STR |
6148 | BGP_SOFT_IN_STR) | |
718e3744 | 6149 | |
6150 | ALIAS (clear_ip_bgp_all_soft_in, | |
6151 | clear_ip_bgp_all_in_cmd, | |
6152 | "clear ip bgp * in", | |
6153 | CLEAR_STR | |
6154 | IP_STR | |
6155 | BGP_STR | |
6156 | "Clear all peers\n" | |
e0bce756 | 6157 | BGP_SOFT_IN_STR) |
718e3744 | 6158 | |
6159 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
6160 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
6161 | "clear ip bgp * in prefix-filter", | |
6162 | CLEAR_STR | |
6163 | IP_STR | |
6164 | BGP_STR | |
6165 | "Clear all peers\n" | |
e0bce756 | 6166 | BGP_SOFT_IN_STR |
718e3744 | 6167 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6168 | { | |
6169 | if (argc== 1) | |
6170 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6171 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6172 | ||
6173 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6174 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6175 | } | |
6176 | ||
6177 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
6178 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
6179 | "clear ip bgp view WORD * in prefix-filter", | |
6180 | CLEAR_STR | |
6181 | IP_STR | |
6182 | BGP_STR | |
6183 | "BGP view\n" | |
6184 | "view name\n" | |
6185 | "Clear all peers\n" | |
e0bce756 | 6186 | BGP_SOFT_IN_STR |
718e3744 | 6187 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6188 | ||
6189 | ||
6190 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
6191 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
6192 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
6193 | CLEAR_STR | |
6194 | IP_STR | |
6195 | BGP_STR | |
6196 | "Clear all peers\n" | |
6197 | "Address family\n" | |
6198 | "Address Family modifier\n" | |
6199 | "Address Family modifier\n" | |
e0bce756 DS |
6200 | BGP_SOFT_STR |
6201 | BGP_SOFT_IN_STR) | |
718e3744 | 6202 | { |
6203 | if (strncmp (argv[0], "m", 1) == 0) | |
6204 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6205 | BGP_CLEAR_SOFT_IN, NULL); | |
6206 | ||
6207 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6208 | BGP_CLEAR_SOFT_IN, NULL); | |
6209 | } | |
6210 | ||
6211 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
6212 | clear_ip_bgp_all_ipv4_in_cmd, | |
6213 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
6214 | CLEAR_STR | |
6215 | IP_STR | |
6216 | BGP_STR | |
6217 | "Clear all peers\n" | |
6218 | "Address family\n" | |
6219 | "Address Family modifier\n" | |
6220 | "Address Family modifier\n" | |
e0bce756 | 6221 | BGP_SOFT_IN_STR) |
718e3744 | 6222 | |
6223 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
6224 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
6225 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
6226 | CLEAR_STR | |
6227 | IP_STR | |
6228 | BGP_STR | |
6229 | "BGP view\n" | |
6230 | "view name\n" | |
6231 | "Clear all peers\n" | |
6232 | "Address family\n" | |
6233 | "Address Family modifier\n" | |
6234 | "Address Family modifier\n" | |
e0bce756 DS |
6235 | BGP_SOFT_STR |
6236 | BGP_SOFT_IN_STR) | |
718e3744 | 6237 | { |
6238 | if (strncmp (argv[1], "m", 1) == 0) | |
6239 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6240 | BGP_CLEAR_SOFT_IN, NULL); | |
6241 | ||
6242 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6243 | BGP_CLEAR_SOFT_IN, NULL); | |
6244 | } | |
6245 | ||
6246 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
6247 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
6248 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
6249 | CLEAR_STR | |
6250 | IP_STR | |
6251 | BGP_STR | |
6252 | "Clear all peers\n" | |
6253 | "Address family\n" | |
6254 | "Address Family modifier\n" | |
6255 | "Address Family modifier\n" | |
e0bce756 | 6256 | BGP_SOFT_IN_STR |
718e3744 | 6257 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6258 | { | |
6259 | if (strncmp (argv[0], "m", 1) == 0) | |
6260 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6261 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6262 | ||
6263 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6264 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6265 | } | |
6266 | ||
6267 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
6268 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
6269 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
6270 | CLEAR_STR | |
6271 | IP_STR | |
6272 | BGP_STR | |
6273 | "Clear all peers\n" | |
6274 | "Address family\n" | |
6275 | "Address Family modifier\n" | |
6276 | "Address Family modifier\n" | |
e0bce756 | 6277 | BGP_SOFT_IN_STR |
718e3744 | 6278 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6279 | { | |
6280 | if (strncmp (argv[1], "m", 1) == 0) | |
6281 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6282 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6283 | ||
6284 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6285 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6286 | } | |
6287 | ||
6288 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
6289 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
6290 | "clear ip bgp * vpnv4 unicast soft in", | |
6291 | CLEAR_STR | |
6292 | IP_STR | |
6293 | BGP_STR | |
6294 | "Clear all peers\n" | |
6295 | "Address family\n" | |
6296 | "Address Family Modifier\n" | |
e0bce756 DS |
6297 | BGP_SOFT_STR |
6298 | BGP_SOFT_IN_STR) | |
718e3744 | 6299 | { |
6300 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6301 | BGP_CLEAR_SOFT_IN, NULL); | |
6302 | } | |
6303 | ||
6304 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
6305 | clear_ip_bgp_all_vpnv4_in_cmd, | |
6306 | "clear ip bgp * vpnv4 unicast in", | |
6307 | CLEAR_STR | |
6308 | IP_STR | |
6309 | BGP_STR | |
6310 | "Clear all peers\n" | |
6311 | "Address family\n" | |
6312 | "Address Family Modifier\n" | |
e0bce756 | 6313 | BGP_SOFT_IN_STR) |
718e3744 | 6314 | |
6315 | DEFUN (clear_bgp_all_soft_in, | |
6316 | clear_bgp_all_soft_in_cmd, | |
6317 | "clear bgp * soft in", | |
6318 | CLEAR_STR | |
6319 | BGP_STR | |
6320 | "Clear all peers\n" | |
e0bce756 DS |
6321 | BGP_SOFT_STR |
6322 | BGP_SOFT_IN_STR) | |
718e3744 | 6323 | { |
6324 | if (argc == 1) | |
6325 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6326 | BGP_CLEAR_SOFT_IN, NULL); | |
6327 | ||
6328 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6329 | BGP_CLEAR_SOFT_IN, NULL); | |
6330 | } | |
6331 | ||
6332 | ALIAS (clear_bgp_all_soft_in, | |
6333 | clear_bgp_instance_all_soft_in_cmd, | |
6334 | "clear bgp view WORD * soft in", | |
6335 | CLEAR_STR | |
6336 | BGP_STR | |
6337 | "BGP view\n" | |
6338 | "view name\n" | |
6339 | "Clear all peers\n" | |
e0bce756 DS |
6340 | BGP_SOFT_STR |
6341 | BGP_SOFT_IN_STR) | |
718e3744 | 6342 | |
6343 | ALIAS (clear_bgp_all_soft_in, | |
6344 | clear_bgp_ipv6_all_soft_in_cmd, | |
6345 | "clear bgp ipv6 * soft in", | |
6346 | CLEAR_STR | |
6347 | BGP_STR | |
6348 | "Address family\n" | |
6349 | "Clear all peers\n" | |
e0bce756 DS |
6350 | BGP_SOFT_STR |
6351 | BGP_SOFT_IN_STR) | |
718e3744 | 6352 | |
6353 | ALIAS (clear_bgp_all_soft_in, | |
6354 | clear_bgp_all_in_cmd, | |
6355 | "clear bgp * in", | |
6356 | CLEAR_STR | |
6357 | BGP_STR | |
6358 | "Clear all peers\n" | |
e0bce756 | 6359 | BGP_SOFT_IN_STR) |
718e3744 | 6360 | |
6361 | ALIAS (clear_bgp_all_soft_in, | |
6362 | clear_bgp_ipv6_all_in_cmd, | |
6363 | "clear bgp ipv6 * in", | |
6364 | CLEAR_STR | |
6365 | BGP_STR | |
6366 | "Address family\n" | |
6367 | "Clear all peers\n" | |
e0bce756 | 6368 | BGP_SOFT_IN_STR) |
718e3744 | 6369 | |
6370 | DEFUN (clear_bgp_all_in_prefix_filter, | |
6371 | clear_bgp_all_in_prefix_filter_cmd, | |
6372 | "clear bgp * in prefix-filter", | |
6373 | CLEAR_STR | |
6374 | BGP_STR | |
6375 | "Clear all peers\n" | |
e0bce756 | 6376 | BGP_SOFT_IN_STR |
718e3744 | 6377 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6378 | { | |
6379 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6380 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6381 | } | |
6382 | ||
6383 | ALIAS (clear_bgp_all_in_prefix_filter, | |
6384 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
6385 | "clear bgp ipv6 * in prefix-filter", | |
6386 | CLEAR_STR | |
6387 | BGP_STR | |
6388 | "Address family\n" | |
6389 | "Clear all peers\n" | |
e0bce756 | 6390 | BGP_SOFT_IN_STR |
718e3744 | 6391 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6392 | ||
6393 | DEFUN (clear_ip_bgp_peer_soft_in, | |
6394 | clear_ip_bgp_peer_soft_in_cmd, | |
6395 | "clear ip bgp A.B.C.D soft in", | |
6396 | CLEAR_STR | |
6397 | IP_STR | |
6398 | BGP_STR | |
6399 | "BGP neighbor address to clear\n" | |
e0bce756 DS |
6400 | BGP_SOFT_STR |
6401 | BGP_SOFT_IN_STR) | |
718e3744 | 6402 | { |
6403 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6404 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6405 | } | |
6406 | ||
6407 | ALIAS (clear_ip_bgp_peer_soft_in, | |
6408 | clear_ip_bgp_peer_in_cmd, | |
6409 | "clear ip bgp A.B.C.D in", | |
6410 | CLEAR_STR | |
6411 | IP_STR | |
6412 | BGP_STR | |
6413 | "BGP neighbor address to clear\n" | |
e0bce756 | 6414 | BGP_SOFT_IN_STR) |
718e3744 | 6415 | |
6416 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
6417 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
6418 | "clear ip bgp A.B.C.D in prefix-filter", | |
6419 | CLEAR_STR | |
6420 | IP_STR | |
6421 | BGP_STR | |
6422 | "BGP neighbor address to clear\n" | |
e0bce756 | 6423 | BGP_SOFT_IN_STR |
718e3744 | 6424 | "Push out the existing ORF prefix-list\n") |
6425 | { | |
6426 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6427 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6428 | } | |
6429 | ||
6430 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
6431 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
6432 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", | |
6433 | CLEAR_STR | |
6434 | IP_STR | |
6435 | BGP_STR | |
6436 | "BGP neighbor address to clear\n" | |
6437 | "Address family\n" | |
6438 | "Address Family modifier\n" | |
6439 | "Address Family modifier\n" | |
e0bce756 DS |
6440 | BGP_SOFT_STR |
6441 | BGP_SOFT_IN_STR) | |
718e3744 | 6442 | { |
6443 | if (strncmp (argv[1], "m", 1) == 0) | |
6444 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6445 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6446 | ||
6447 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6448 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6449 | } | |
6450 | ||
6451 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
6452 | clear_ip_bgp_peer_ipv4_in_cmd, | |
6453 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", | |
6454 | CLEAR_STR | |
6455 | IP_STR | |
6456 | BGP_STR | |
6457 | "BGP neighbor address to clear\n" | |
6458 | "Address family\n" | |
6459 | "Address Family modifier\n" | |
6460 | "Address Family modifier\n" | |
e0bce756 | 6461 | BGP_SOFT_IN_STR) |
718e3744 | 6462 | |
6463 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
6464 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
6465 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", | |
6466 | CLEAR_STR | |
6467 | IP_STR | |
6468 | BGP_STR | |
6469 | "BGP neighbor address to clear\n" | |
6470 | "Address family\n" | |
6471 | "Address Family modifier\n" | |
6472 | "Address Family modifier\n" | |
e0bce756 | 6473 | BGP_SOFT_IN_STR |
718e3744 | 6474 | "Push out the existing ORF prefix-list\n") |
6475 | { | |
6476 | if (strncmp (argv[1], "m", 1) == 0) | |
6477 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6478 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6479 | ||
6480 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6481 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6482 | } | |
6483 | ||
6484 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
6485 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
6486 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", | |
6487 | CLEAR_STR | |
6488 | IP_STR | |
6489 | BGP_STR | |
6490 | "BGP neighbor address to clear\n" | |
6491 | "Address family\n" | |
6492 | "Address Family Modifier\n" | |
e0bce756 DS |
6493 | BGP_SOFT_STR |
6494 | BGP_SOFT_IN_STR) | |
718e3744 | 6495 | { |
6496 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6497 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6498 | } | |
6499 | ||
6500 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
6501 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
6502 | "clear ip bgp A.B.C.D vpnv4 unicast in", | |
6503 | CLEAR_STR | |
6504 | IP_STR | |
6505 | BGP_STR | |
6506 | "BGP neighbor address to clear\n" | |
6507 | "Address family\n" | |
6508 | "Address Family Modifier\n" | |
e0bce756 | 6509 | BGP_SOFT_IN_STR) |
718e3744 | 6510 | |
6511 | DEFUN (clear_bgp_peer_soft_in, | |
6512 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 6513 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 6514 | CLEAR_STR |
6515 | BGP_STR | |
6516 | "BGP neighbor address to clear\n" | |
6517 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6518 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6519 | BGP_SOFT_STR |
6520 | BGP_SOFT_IN_STR) | |
718e3744 | 6521 | { |
6522 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6523 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6524 | } | |
6525 | ||
6526 | ALIAS (clear_bgp_peer_soft_in, | |
6527 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 6528 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 6529 | CLEAR_STR |
6530 | BGP_STR | |
6531 | "Address family\n" | |
6532 | "BGP neighbor address to clear\n" | |
6533 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6534 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6535 | BGP_SOFT_STR |
6536 | BGP_SOFT_IN_STR) | |
718e3744 | 6537 | |
6538 | ALIAS (clear_bgp_peer_soft_in, | |
6539 | clear_bgp_peer_in_cmd, | |
a80beece | 6540 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 6541 | CLEAR_STR |
6542 | BGP_STR | |
6543 | "BGP neighbor address to clear\n" | |
6544 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6545 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6546 | BGP_SOFT_IN_STR) |
718e3744 | 6547 | |
6548 | ALIAS (clear_bgp_peer_soft_in, | |
6549 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 6550 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 6551 | CLEAR_STR |
6552 | BGP_STR | |
6553 | "Address family\n" | |
6554 | "BGP neighbor address to clear\n" | |
6555 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6556 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6557 | BGP_SOFT_IN_STR) |
718e3744 | 6558 | |
6559 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
6560 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 6561 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 6562 | CLEAR_STR |
6563 | BGP_STR | |
6564 | "BGP neighbor address to clear\n" | |
6565 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6566 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6567 | BGP_SOFT_IN_STR |
718e3744 | 6568 | "Push out the existing ORF prefix-list\n") |
6569 | { | |
6570 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6571 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6572 | } | |
6573 | ||
6574 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
6575 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 6576 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 6577 | CLEAR_STR |
6578 | BGP_STR | |
6579 | "Address family\n" | |
6580 | "BGP neighbor address to clear\n" | |
6581 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6582 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6583 | BGP_SOFT_IN_STR |
718e3744 | 6584 | "Push out the existing ORF prefix-list\n") |
6585 | ||
6586 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
6587 | clear_ip_bgp_peer_group_soft_in_cmd, | |
6588 | "clear ip bgp peer-group WORD soft in", | |
6589 | CLEAR_STR | |
6590 | IP_STR | |
6591 | BGP_STR | |
6592 | "Clear all members of peer-group\n" | |
6593 | "BGP peer-group name\n" | |
e0bce756 DS |
6594 | BGP_SOFT_STR |
6595 | BGP_SOFT_IN_STR) | |
718e3744 | 6596 | { |
6597 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6598 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6599 | } | |
6600 | ||
6601 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
6602 | clear_ip_bgp_peer_group_in_cmd, | |
6603 | "clear ip bgp peer-group WORD in", | |
6604 | CLEAR_STR | |
6605 | IP_STR | |
6606 | BGP_STR | |
6607 | "Clear all members of peer-group\n" | |
6608 | "BGP peer-group name\n" | |
e0bce756 | 6609 | BGP_SOFT_IN_STR) |
718e3744 | 6610 | |
6611 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
6612 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
6613 | "clear ip bgp peer-group WORD in prefix-filter", | |
6614 | CLEAR_STR | |
6615 | IP_STR | |
6616 | BGP_STR | |
6617 | "Clear all members of peer-group\n" | |
6618 | "BGP peer-group name\n" | |
e0bce756 | 6619 | BGP_SOFT_IN_STR |
718e3744 | 6620 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6621 | { | |
6622 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6623 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6624 | } | |
6625 | ||
6626 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
6627 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
6628 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
6629 | CLEAR_STR | |
6630 | IP_STR | |
6631 | BGP_STR | |
6632 | "Clear all members of peer-group\n" | |
6633 | "BGP peer-group name\n" | |
6634 | "Address family\n" | |
6635 | "Address Family modifier\n" | |
6636 | "Address Family modifier\n" | |
e0bce756 DS |
6637 | BGP_SOFT_STR |
6638 | BGP_SOFT_IN_STR) | |
718e3744 | 6639 | { |
6640 | if (strncmp (argv[1], "m", 1) == 0) | |
6641 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6642 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6643 | ||
6644 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6645 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6646 | } | |
6647 | ||
6648 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
6649 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
6650 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
6651 | CLEAR_STR | |
6652 | IP_STR | |
6653 | BGP_STR | |
6654 | "Clear all members of peer-group\n" | |
6655 | "BGP peer-group name\n" | |
6656 | "Address family\n" | |
6657 | "Address Family modifier\n" | |
6658 | "Address Family modifier\n" | |
e0bce756 | 6659 | BGP_SOFT_IN_STR) |
718e3744 | 6660 | |
6661 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
6662 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
6663 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
6664 | CLEAR_STR | |
6665 | IP_STR | |
6666 | BGP_STR | |
6667 | "Clear all members of peer-group\n" | |
6668 | "BGP peer-group name\n" | |
6669 | "Address family\n" | |
6670 | "Address Family modifier\n" | |
6671 | "Address Family modifier\n" | |
e0bce756 | 6672 | BGP_SOFT_IN_STR |
718e3744 | 6673 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6674 | { | |
6675 | if (strncmp (argv[1], "m", 1) == 0) | |
6676 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6677 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6678 | ||
6679 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6680 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6681 | } | |
6682 | ||
6683 | DEFUN (clear_bgp_peer_group_soft_in, | |
6684 | clear_bgp_peer_group_soft_in_cmd, | |
6685 | "clear bgp peer-group WORD soft in", | |
6686 | CLEAR_STR | |
6687 | BGP_STR | |
6688 | "Clear all members of peer-group\n" | |
6689 | "BGP peer-group name\n" | |
e0bce756 DS |
6690 | BGP_SOFT_STR |
6691 | BGP_SOFT_IN_STR) | |
718e3744 | 6692 | { |
6693 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6694 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6695 | } | |
6696 | ||
6697 | ALIAS (clear_bgp_peer_group_soft_in, | |
6698 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
6699 | "clear bgp ipv6 peer-group WORD soft in", | |
6700 | CLEAR_STR | |
6701 | BGP_STR | |
6702 | "Address family\n" | |
6703 | "Clear all members of peer-group\n" | |
6704 | "BGP peer-group name\n" | |
e0bce756 DS |
6705 | BGP_SOFT_STR |
6706 | BGP_SOFT_IN_STR) | |
718e3744 | 6707 | |
6708 | ALIAS (clear_bgp_peer_group_soft_in, | |
6709 | clear_bgp_peer_group_in_cmd, | |
6710 | "clear bgp peer-group WORD in", | |
6711 | CLEAR_STR | |
6712 | BGP_STR | |
6713 | "Clear all members of peer-group\n" | |
6714 | "BGP peer-group name\n" | |
e0bce756 | 6715 | BGP_SOFT_IN_STR) |
718e3744 | 6716 | |
6717 | ALIAS (clear_bgp_peer_group_soft_in, | |
6718 | clear_bgp_ipv6_peer_group_in_cmd, | |
6719 | "clear bgp ipv6 peer-group WORD in", | |
6720 | CLEAR_STR | |
6721 | BGP_STR | |
6722 | "Address family\n" | |
6723 | "Clear all members of peer-group\n" | |
6724 | "BGP peer-group name\n" | |
e0bce756 | 6725 | BGP_SOFT_IN_STR) |
718e3744 | 6726 | |
6727 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
6728 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
6729 | "clear bgp peer-group WORD in prefix-filter", | |
6730 | CLEAR_STR | |
6731 | BGP_STR | |
6732 | "Clear all members of peer-group\n" | |
6733 | "BGP peer-group name\n" | |
e0bce756 | 6734 | BGP_SOFT_IN_STR |
718e3744 | 6735 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6736 | { | |
6737 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6738 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6739 | } | |
6740 | ||
6741 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
6742 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
6743 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
6744 | CLEAR_STR | |
6745 | BGP_STR | |
6746 | "Address family\n" | |
6747 | "Clear all members of peer-group\n" | |
6748 | "BGP peer-group name\n" | |
e0bce756 | 6749 | BGP_SOFT_IN_STR |
718e3744 | 6750 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6751 | ||
6752 | DEFUN (clear_ip_bgp_external_soft_in, | |
6753 | clear_ip_bgp_external_soft_in_cmd, | |
6754 | "clear ip bgp external soft in", | |
6755 | CLEAR_STR | |
6756 | IP_STR | |
6757 | BGP_STR | |
6758 | "Clear all external peers\n" | |
e0bce756 DS |
6759 | BGP_SOFT_STR |
6760 | BGP_SOFT_IN_STR) | |
718e3744 | 6761 | { |
6762 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6763 | BGP_CLEAR_SOFT_IN, NULL); | |
6764 | } | |
6765 | ||
6766 | ALIAS (clear_ip_bgp_external_soft_in, | |
6767 | clear_ip_bgp_external_in_cmd, | |
6768 | "clear ip bgp external in", | |
6769 | CLEAR_STR | |
6770 | IP_STR | |
6771 | BGP_STR | |
6772 | "Clear all external peers\n" | |
e0bce756 | 6773 | BGP_SOFT_IN_STR) |
718e3744 | 6774 | |
6775 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
6776 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
6777 | "clear ip bgp external in prefix-filter", | |
6778 | CLEAR_STR | |
6779 | IP_STR | |
6780 | BGP_STR | |
6781 | "Clear all external peers\n" | |
e0bce756 | 6782 | BGP_SOFT_IN_STR |
718e3744 | 6783 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6784 | { | |
6785 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6786 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6787 | } | |
6788 | ||
6789 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
6790 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
6791 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
6792 | CLEAR_STR | |
6793 | IP_STR | |
6794 | BGP_STR | |
6795 | "Clear all external peers\n" | |
6796 | "Address family\n" | |
6797 | "Address Family modifier\n" | |
6798 | "Address Family modifier\n" | |
e0bce756 DS |
6799 | BGP_SOFT_STR |
6800 | BGP_SOFT_IN_STR) | |
718e3744 | 6801 | { |
6802 | if (strncmp (argv[0], "m", 1) == 0) | |
6803 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6804 | BGP_CLEAR_SOFT_IN, NULL); | |
6805 | ||
6806 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6807 | BGP_CLEAR_SOFT_IN, NULL); | |
6808 | } | |
6809 | ||
6810 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
6811 | clear_ip_bgp_external_ipv4_in_cmd, | |
6812 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
6813 | CLEAR_STR | |
6814 | IP_STR | |
6815 | BGP_STR | |
6816 | "Clear all external peers\n" | |
6817 | "Address family\n" | |
6818 | "Address Family modifier\n" | |
6819 | "Address Family modifier\n" | |
e0bce756 | 6820 | BGP_SOFT_IN_STR) |
718e3744 | 6821 | |
6822 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
6823 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
6824 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
6825 | CLEAR_STR | |
6826 | IP_STR | |
6827 | BGP_STR | |
6828 | "Clear all external peers\n" | |
6829 | "Address family\n" | |
6830 | "Address Family modifier\n" | |
6831 | "Address Family modifier\n" | |
e0bce756 | 6832 | BGP_SOFT_IN_STR |
718e3744 | 6833 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6834 | { | |
6835 | if (strncmp (argv[0], "m", 1) == 0) | |
6836 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6837 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6838 | ||
6839 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6840 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6841 | } | |
6842 | ||
6843 | DEFUN (clear_bgp_external_soft_in, | |
6844 | clear_bgp_external_soft_in_cmd, | |
6845 | "clear bgp external soft in", | |
6846 | CLEAR_STR | |
6847 | BGP_STR | |
6848 | "Clear all external peers\n" | |
e0bce756 DS |
6849 | BGP_SOFT_STR |
6850 | BGP_SOFT_IN_STR) | |
718e3744 | 6851 | { |
6852 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6853 | BGP_CLEAR_SOFT_IN, NULL); | |
6854 | } | |
6855 | ||
6856 | ALIAS (clear_bgp_external_soft_in, | |
6857 | clear_bgp_ipv6_external_soft_in_cmd, | |
6858 | "clear bgp ipv6 external soft in", | |
6859 | CLEAR_STR | |
6860 | BGP_STR | |
6861 | "Address family\n" | |
6862 | "Clear all external peers\n" | |
e0bce756 DS |
6863 | BGP_SOFT_STR |
6864 | BGP_SOFT_IN_STR) | |
718e3744 | 6865 | |
6866 | ALIAS (clear_bgp_external_soft_in, | |
6867 | clear_bgp_external_in_cmd, | |
6868 | "clear bgp external in", | |
6869 | CLEAR_STR | |
6870 | BGP_STR | |
6871 | "Clear all external peers\n" | |
e0bce756 | 6872 | BGP_SOFT_IN_STR) |
718e3744 | 6873 | |
6874 | ALIAS (clear_bgp_external_soft_in, | |
6875 | clear_bgp_ipv6_external_in_cmd, | |
6876 | "clear bgp ipv6 external WORD in", | |
6877 | CLEAR_STR | |
6878 | BGP_STR | |
6879 | "Address family\n" | |
6880 | "Clear all external peers\n" | |
e0bce756 | 6881 | BGP_SOFT_IN_STR) |
718e3744 | 6882 | |
6883 | DEFUN (clear_bgp_external_in_prefix_filter, | |
6884 | clear_bgp_external_in_prefix_filter_cmd, | |
6885 | "clear bgp external in prefix-filter", | |
6886 | CLEAR_STR | |
6887 | BGP_STR | |
6888 | "Clear all external peers\n" | |
e0bce756 | 6889 | BGP_SOFT_IN_STR |
718e3744 | 6890 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6891 | { | |
6892 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6893 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6894 | } | |
6895 | ||
6896 | ALIAS (clear_bgp_external_in_prefix_filter, | |
6897 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
6898 | "clear bgp ipv6 external in prefix-filter", | |
6899 | CLEAR_STR | |
6900 | BGP_STR | |
6901 | "Address family\n" | |
6902 | "Clear all external peers\n" | |
e0bce756 | 6903 | BGP_SOFT_IN_STR |
718e3744 | 6904 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6905 | ||
6906 | DEFUN (clear_ip_bgp_as_soft_in, | |
6907 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 6908 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 6909 | CLEAR_STR |
6910 | IP_STR | |
6911 | BGP_STR | |
6912 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6913 | BGP_SOFT_STR |
6914 | BGP_SOFT_IN_STR) | |
718e3744 | 6915 | { |
6916 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6917 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6918 | } | |
6919 | ||
6920 | ALIAS (clear_ip_bgp_as_soft_in, | |
6921 | clear_ip_bgp_as_in_cmd, | |
320da874 | 6922 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 6923 | CLEAR_STR |
6924 | IP_STR | |
6925 | BGP_STR | |
6926 | "Clear peers with the AS number\n" | |
e0bce756 | 6927 | BGP_SOFT_IN_STR) |
718e3744 | 6928 | |
6929 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
6930 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 6931 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 6932 | CLEAR_STR |
6933 | IP_STR | |
6934 | BGP_STR | |
6935 | "Clear peers with the AS number\n" | |
e0bce756 | 6936 | BGP_SOFT_IN_STR |
718e3744 | 6937 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6938 | { | |
6939 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6940 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6941 | } | |
6942 | ||
6943 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
6944 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 6945 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 6946 | CLEAR_STR |
6947 | IP_STR | |
6948 | BGP_STR | |
6949 | "Clear peers with the AS number\n" | |
6950 | "Address family\n" | |
6951 | "Address Family modifier\n" | |
6952 | "Address Family modifier\n" | |
e0bce756 DS |
6953 | BGP_SOFT_STR |
6954 | BGP_SOFT_IN_STR) | |
718e3744 | 6955 | { |
6956 | if (strncmp (argv[1], "m", 1) == 0) | |
6957 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6958 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6959 | ||
6960 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6961 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6962 | } | |
6963 | ||
6964 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
6965 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 6966 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 6967 | CLEAR_STR |
6968 | IP_STR | |
6969 | BGP_STR | |
6970 | "Clear peers with the AS number\n" | |
6971 | "Address family\n" | |
6972 | "Address Family modifier\n" | |
6973 | "Address Family modifier\n" | |
e0bce756 | 6974 | BGP_SOFT_IN_STR) |
718e3744 | 6975 | |
6976 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
6977 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 6978 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 6979 | CLEAR_STR |
6980 | IP_STR | |
6981 | BGP_STR | |
6982 | "Clear peers with the AS number\n" | |
6983 | "Address family\n" | |
6984 | "Address Family modifier\n" | |
6985 | "Address Family modifier\n" | |
e0bce756 | 6986 | BGP_SOFT_IN_STR |
718e3744 | 6987 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6988 | { | |
6989 | if (strncmp (argv[1], "m", 1) == 0) | |
6990 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6991 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6992 | ||
6993 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6994 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6995 | } | |
6996 | ||
6997 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
6998 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 6999 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 7000 | CLEAR_STR |
7001 | IP_STR | |
7002 | BGP_STR | |
7003 | "Clear peers with the AS number\n" | |
7004 | "Address family\n" | |
7005 | "Address Family modifier\n" | |
e0bce756 DS |
7006 | BGP_SOFT_STR |
7007 | BGP_SOFT_IN_STR) | |
718e3744 | 7008 | { |
7009 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7010 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7011 | } | |
7012 | ||
7013 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
7014 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 7015 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 7016 | CLEAR_STR |
7017 | IP_STR | |
7018 | BGP_STR | |
7019 | "Clear peers with the AS number\n" | |
7020 | "Address family\n" | |
7021 | "Address Family modifier\n" | |
e0bce756 | 7022 | BGP_SOFT_IN_STR) |
718e3744 | 7023 | |
7024 | DEFUN (clear_bgp_as_soft_in, | |
7025 | clear_bgp_as_soft_in_cmd, | |
320da874 | 7026 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7027 | CLEAR_STR |
7028 | BGP_STR | |
7029 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7030 | BGP_SOFT_STR |
7031 | BGP_SOFT_IN_STR) | |
718e3744 | 7032 | { |
7033 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7034 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7035 | } | |
7036 | ||
7037 | ALIAS (clear_bgp_as_soft_in, | |
7038 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 7039 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 7040 | CLEAR_STR |
7041 | BGP_STR | |
7042 | "Address family\n" | |
7043 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7044 | BGP_SOFT_STR |
7045 | BGP_SOFT_IN_STR) | |
718e3744 | 7046 | |
7047 | ALIAS (clear_bgp_as_soft_in, | |
7048 | clear_bgp_as_in_cmd, | |
320da874 | 7049 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 7050 | CLEAR_STR |
7051 | BGP_STR | |
7052 | "Clear peers with the AS number\n" | |
e0bce756 | 7053 | BGP_SOFT_IN_STR) |
718e3744 | 7054 | |
7055 | ALIAS (clear_bgp_as_soft_in, | |
7056 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 7057 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 7058 | CLEAR_STR |
7059 | BGP_STR | |
7060 | "Address family\n" | |
7061 | "Clear peers with the AS number\n" | |
e0bce756 | 7062 | BGP_SOFT_IN_STR) |
718e3744 | 7063 | |
7064 | DEFUN (clear_bgp_as_in_prefix_filter, | |
7065 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7066 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7067 | CLEAR_STR |
7068 | BGP_STR | |
7069 | "Clear peers with the AS number\n" | |
e0bce756 | 7070 | BGP_SOFT_IN_STR |
718e3744 | 7071 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7072 | { | |
7073 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7074 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7075 | } | |
7076 | ||
7077 | ALIAS (clear_bgp_as_in_prefix_filter, | |
7078 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 7079 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7080 | CLEAR_STR |
7081 | BGP_STR | |
7082 | "Address family\n" | |
7083 | "Clear peers with the AS number\n" | |
e0bce756 | 7084 | BGP_SOFT_IN_STR |
718e3744 | 7085 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 7086 | |
718e3744 | 7087 | /* Both soft-reconfiguration */ |
7088 | DEFUN (clear_ip_bgp_all_soft, | |
7089 | clear_ip_bgp_all_soft_cmd, | |
7090 | "clear ip bgp * soft", | |
7091 | CLEAR_STR | |
7092 | IP_STR | |
7093 | BGP_STR | |
7094 | "Clear all peers\n" | |
e0bce756 | 7095 | BGP_SOFT_STR) |
718e3744 | 7096 | { |
7097 | if (argc == 1) | |
7098 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7099 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7100 | ||
7101 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7102 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7103 | } | |
7104 | ||
7105 | ALIAS (clear_ip_bgp_all_soft, | |
7106 | clear_ip_bgp_instance_all_soft_cmd, | |
7107 | "clear ip bgp view WORD * soft", | |
7108 | CLEAR_STR | |
7109 | IP_STR | |
7110 | BGP_STR | |
7111 | "BGP view\n" | |
7112 | "view name\n" | |
7113 | "Clear all peers\n" | |
e0bce756 | 7114 | BGP_SOFT_STR) |
718e3744 | 7115 | |
7116 | ||
7117 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
7118 | clear_ip_bgp_all_ipv4_soft_cmd, | |
7119 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
7120 | CLEAR_STR | |
7121 | IP_STR | |
7122 | BGP_STR | |
7123 | "Clear all peers\n" | |
7124 | "Address family\n" | |
7125 | "Address Family Modifier\n" | |
7126 | "Address Family Modifier\n" | |
e0bce756 | 7127 | BGP_SOFT_STR) |
718e3744 | 7128 | { |
7129 | if (strncmp (argv[0], "m", 1) == 0) | |
7130 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7131 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7132 | ||
7133 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7134 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7135 | } | |
7136 | ||
7137 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
7138 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
7139 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
7140 | CLEAR_STR | |
7141 | IP_STR | |
7142 | BGP_STR | |
7143 | "BGP view\n" | |
7144 | "view name\n" | |
7145 | "Clear all peers\n" | |
7146 | "Address family\n" | |
7147 | "Address Family Modifier\n" | |
7148 | "Address Family Modifier\n" | |
e0bce756 | 7149 | BGP_SOFT_STR) |
718e3744 | 7150 | { |
7151 | if (strncmp (argv[1], "m", 1) == 0) | |
7152 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7153 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7154 | ||
7155 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7156 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7157 | } | |
7158 | ||
7159 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
7160 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
7161 | "clear ip bgp * vpnv4 unicast soft", | |
7162 | CLEAR_STR | |
7163 | IP_STR | |
7164 | BGP_STR | |
7165 | "Clear all peers\n" | |
7166 | "Address family\n" | |
7167 | "Address Family Modifier\n" | |
e0bce756 | 7168 | BGP_SOFT_STR) |
718e3744 | 7169 | { |
7170 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7171 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7172 | } | |
7173 | ||
7174 | DEFUN (clear_bgp_all_soft, | |
7175 | clear_bgp_all_soft_cmd, | |
7176 | "clear bgp * soft", | |
7177 | CLEAR_STR | |
7178 | BGP_STR | |
7179 | "Clear all peers\n" | |
e0bce756 | 7180 | BGP_SOFT_STR) |
718e3744 | 7181 | { |
7182 | if (argc == 1) | |
7183 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7184 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7185 | ||
7186 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7187 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7188 | } | |
7189 | ||
7190 | ALIAS (clear_bgp_all_soft, | |
7191 | clear_bgp_instance_all_soft_cmd, | |
7192 | "clear bgp view WORD * soft", | |
7193 | CLEAR_STR | |
7194 | BGP_STR | |
7195 | "BGP view\n" | |
7196 | "view name\n" | |
7197 | "Clear all peers\n" | |
e0bce756 | 7198 | BGP_SOFT_STR) |
718e3744 | 7199 | |
7200 | ALIAS (clear_bgp_all_soft, | |
7201 | clear_bgp_ipv6_all_soft_cmd, | |
7202 | "clear bgp ipv6 * soft", | |
7203 | CLEAR_STR | |
7204 | BGP_STR | |
7205 | "Address family\n" | |
7206 | "Clear all peers\n" | |
e0bce756 | 7207 | BGP_SOFT_STR) |
718e3744 | 7208 | |
7209 | DEFUN (clear_ip_bgp_peer_soft, | |
7210 | clear_ip_bgp_peer_soft_cmd, | |
7211 | "clear ip bgp A.B.C.D soft", | |
7212 | CLEAR_STR | |
7213 | IP_STR | |
7214 | BGP_STR | |
7215 | "BGP neighbor address to clear\n" | |
e0bce756 | 7216 | BGP_SOFT_STR) |
718e3744 | 7217 | { |
7218 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7219 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7220 | } | |
7221 | ||
7222 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
7223 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
7224 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", | |
7225 | CLEAR_STR | |
7226 | IP_STR | |
7227 | BGP_STR | |
7228 | "BGP neighbor address to clear\n" | |
7229 | "Address family\n" | |
7230 | "Address Family Modifier\n" | |
7231 | "Address Family Modifier\n" | |
e0bce756 | 7232 | BGP_SOFT_STR) |
718e3744 | 7233 | { |
7234 | if (strncmp (argv[1], "m", 1) == 0) | |
7235 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7236 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7237 | ||
7238 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7239 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7240 | } | |
7241 | ||
7242 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
7243 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
7244 | "clear ip bgp A.B.C.D vpnv4 unicast soft", | |
7245 | CLEAR_STR | |
7246 | IP_STR | |
7247 | BGP_STR | |
7248 | "BGP neighbor address to clear\n" | |
7249 | "Address family\n" | |
7250 | "Address Family Modifier\n" | |
e0bce756 | 7251 | BGP_SOFT_STR) |
718e3744 | 7252 | { |
7253 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7254 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7255 | } | |
7256 | ||
7257 | DEFUN (clear_bgp_peer_soft, | |
7258 | clear_bgp_peer_soft_cmd, | |
a80beece | 7259 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7260 | CLEAR_STR |
7261 | BGP_STR | |
7262 | "BGP neighbor address to clear\n" | |
7263 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7264 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7265 | BGP_SOFT_STR) |
718e3744 | 7266 | { |
7267 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7268 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7269 | } | |
7270 | ||
7271 | ALIAS (clear_bgp_peer_soft, | |
7272 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 7273 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7274 | CLEAR_STR |
7275 | BGP_STR | |
7276 | "Address family\n" | |
7277 | "BGP neighbor address to clear\n" | |
7278 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7279 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7280 | BGP_SOFT_STR) |
718e3744 | 7281 | |
7282 | DEFUN (clear_ip_bgp_peer_group_soft, | |
7283 | clear_ip_bgp_peer_group_soft_cmd, | |
7284 | "clear ip bgp peer-group WORD soft", | |
7285 | CLEAR_STR | |
7286 | IP_STR | |
7287 | BGP_STR | |
7288 | "Clear all members of peer-group\n" | |
7289 | "BGP peer-group name\n" | |
e0bce756 | 7290 | BGP_SOFT_STR) |
718e3744 | 7291 | { |
7292 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7293 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7294 | } | |
7295 | ||
7296 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
7297 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
7298 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
7299 | CLEAR_STR | |
7300 | IP_STR | |
7301 | BGP_STR | |
7302 | "Clear all members of peer-group\n" | |
7303 | "BGP peer-group name\n" | |
7304 | "Address family\n" | |
7305 | "Address Family modifier\n" | |
7306 | "Address Family modifier\n" | |
e0bce756 | 7307 | BGP_SOFT_STR) |
718e3744 | 7308 | { |
7309 | if (strncmp (argv[1], "m", 1) == 0) | |
7310 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7311 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7312 | ||
7313 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7314 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7315 | } | |
7316 | ||
7317 | DEFUN (clear_bgp_peer_group_soft, | |
7318 | clear_bgp_peer_group_soft_cmd, | |
7319 | "clear bgp peer-group WORD soft", | |
7320 | CLEAR_STR | |
7321 | BGP_STR | |
7322 | "Clear all members of peer-group\n" | |
7323 | "BGP peer-group name\n" | |
e0bce756 | 7324 | BGP_SOFT_STR) |
718e3744 | 7325 | { |
7326 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7327 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7328 | } | |
7329 | ||
7330 | ALIAS (clear_bgp_peer_group_soft, | |
7331 | clear_bgp_ipv6_peer_group_soft_cmd, | |
7332 | "clear bgp ipv6 peer-group WORD soft", | |
7333 | CLEAR_STR | |
7334 | BGP_STR | |
7335 | "Address family\n" | |
7336 | "Clear all members of peer-group\n" | |
7337 | "BGP peer-group name\n" | |
e0bce756 | 7338 | BGP_SOFT_STR) |
718e3744 | 7339 | |
7340 | DEFUN (clear_ip_bgp_external_soft, | |
7341 | clear_ip_bgp_external_soft_cmd, | |
7342 | "clear ip bgp external soft", | |
7343 | CLEAR_STR | |
7344 | IP_STR | |
7345 | BGP_STR | |
7346 | "Clear all external peers\n" | |
e0bce756 | 7347 | BGP_SOFT_STR) |
718e3744 | 7348 | { |
7349 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7350 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7351 | } | |
7352 | ||
7353 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
7354 | clear_ip_bgp_external_ipv4_soft_cmd, | |
7355 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
7356 | CLEAR_STR | |
7357 | IP_STR | |
7358 | BGP_STR | |
7359 | "Clear all external peers\n" | |
7360 | "Address family\n" | |
7361 | "Address Family modifier\n" | |
7362 | "Address Family modifier\n" | |
e0bce756 | 7363 | BGP_SOFT_STR) |
718e3744 | 7364 | { |
7365 | if (strncmp (argv[0], "m", 1) == 0) | |
7366 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7367 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7368 | ||
7369 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7370 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7371 | } | |
7372 | ||
7373 | DEFUN (clear_bgp_external_soft, | |
7374 | clear_bgp_external_soft_cmd, | |
7375 | "clear bgp external soft", | |
7376 | CLEAR_STR | |
7377 | BGP_STR | |
7378 | "Clear all external peers\n" | |
e0bce756 | 7379 | BGP_SOFT_STR) |
718e3744 | 7380 | { |
7381 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7382 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7383 | } | |
7384 | ||
7385 | ALIAS (clear_bgp_external_soft, | |
7386 | clear_bgp_ipv6_external_soft_cmd, | |
7387 | "clear bgp ipv6 external soft", | |
7388 | CLEAR_STR | |
7389 | BGP_STR | |
7390 | "Address family\n" | |
7391 | "Clear all external peers\n" | |
e0bce756 | 7392 | BGP_SOFT_STR) |
718e3744 | 7393 | |
7394 | DEFUN (clear_ip_bgp_as_soft, | |
7395 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 7396 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 7397 | CLEAR_STR |
7398 | IP_STR | |
7399 | BGP_STR | |
7400 | "Clear peers with the AS number\n" | |
e0bce756 | 7401 | BGP_SOFT_STR) |
718e3744 | 7402 | { |
7403 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7404 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7405 | } | |
7406 | ||
7407 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
7408 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 7409 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 7410 | CLEAR_STR |
7411 | IP_STR | |
7412 | BGP_STR | |
7413 | "Clear peers with the AS number\n" | |
7414 | "Address family\n" | |
7415 | "Address Family Modifier\n" | |
7416 | "Address Family Modifier\n" | |
e0bce756 | 7417 | BGP_SOFT_STR) |
718e3744 | 7418 | { |
7419 | if (strncmp (argv[1], "m", 1) == 0) | |
7420 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7421 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7422 | ||
7423 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
7424 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7425 | } | |
7426 | ||
7427 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
7428 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 7429 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 7430 | CLEAR_STR |
7431 | IP_STR | |
7432 | BGP_STR | |
7433 | "Clear peers with the AS number\n" | |
7434 | "Address family\n" | |
7435 | "Address Family Modifier\n" | |
e0bce756 | 7436 | BGP_SOFT_STR) |
718e3744 | 7437 | { |
7438 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7439 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7440 | } | |
7441 | ||
7442 | DEFUN (clear_bgp_as_soft, | |
7443 | clear_bgp_as_soft_cmd, | |
320da874 | 7444 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 7445 | CLEAR_STR |
7446 | BGP_STR | |
7447 | "Clear peers with the AS number\n" | |
e0bce756 | 7448 | BGP_SOFT_STR) |
718e3744 | 7449 | { |
7450 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7451 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7452 | } | |
7453 | ||
7454 | ALIAS (clear_bgp_as_soft, | |
7455 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 7456 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 7457 | CLEAR_STR |
7458 | BGP_STR | |
7459 | "Address family\n" | |
7460 | "Clear peers with the AS number\n" | |
e0bce756 | 7461 | BGP_SOFT_STR) |
6b0655a2 | 7462 | |
fee0f4c6 | 7463 | /* RS-client soft reconfiguration. */ |
7464 | #ifdef HAVE_IPV6 | |
7465 | DEFUN (clear_bgp_all_rsclient, | |
7466 | clear_bgp_all_rsclient_cmd, | |
7467 | "clear bgp * rsclient", | |
7468 | CLEAR_STR | |
7469 | BGP_STR | |
7470 | "Clear all peers\n" | |
e0bce756 | 7471 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7472 | { |
7473 | if (argc == 1) | |
7474 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7475 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7476 | ||
7477 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7478 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7479 | } | |
7480 | ||
7481 | ALIAS (clear_bgp_all_rsclient, | |
7482 | clear_bgp_ipv6_all_rsclient_cmd, | |
7483 | "clear bgp ipv6 * rsclient", | |
7484 | CLEAR_STR | |
7485 | BGP_STR | |
7486 | "Address family\n" | |
7487 | "Clear all peers\n" | |
e0bce756 | 7488 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7489 | |
7490 | ALIAS (clear_bgp_all_rsclient, | |
7491 | clear_bgp_instance_all_rsclient_cmd, | |
7492 | "clear bgp view WORD * rsclient", | |
7493 | CLEAR_STR | |
7494 | BGP_STR | |
7495 | "BGP view\n" | |
7496 | "view name\n" | |
7497 | "Clear all peers\n" | |
e0bce756 | 7498 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7499 | |
7500 | ALIAS (clear_bgp_all_rsclient, | |
7501 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
7502 | "clear bgp ipv6 view WORD * rsclient", | |
7503 | CLEAR_STR | |
7504 | BGP_STR | |
7505 | "Address family\n" | |
7506 | "BGP view\n" | |
7507 | "view name\n" | |
7508 | "Clear all peers\n" | |
e0bce756 | 7509 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7510 | #endif /* HAVE_IPV6 */ |
7511 | ||
7512 | DEFUN (clear_ip_bgp_all_rsclient, | |
7513 | clear_ip_bgp_all_rsclient_cmd, | |
7514 | "clear ip bgp * rsclient", | |
7515 | CLEAR_STR | |
7516 | IP_STR | |
7517 | BGP_STR | |
7518 | "Clear all peers\n" | |
e0bce756 | 7519 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7520 | { |
7521 | if (argc == 1) | |
7522 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7523 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7524 | ||
7525 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7526 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7527 | } | |
7528 | ||
7529 | ALIAS (clear_ip_bgp_all_rsclient, | |
7530 | clear_ip_bgp_instance_all_rsclient_cmd, | |
7531 | "clear ip bgp view WORD * rsclient", | |
7532 | CLEAR_STR | |
7533 | IP_STR | |
7534 | BGP_STR | |
7535 | "BGP view\n" | |
7536 | "view name\n" | |
7537 | "Clear all peers\n" | |
e0bce756 | 7538 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7539 | |
7540 | #ifdef HAVE_IPV6 | |
7541 | DEFUN (clear_bgp_peer_rsclient, | |
7542 | clear_bgp_peer_rsclient_cmd, | |
a80beece | 7543 | "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7544 | CLEAR_STR |
7545 | BGP_STR | |
7546 | "BGP neighbor IP address to clear\n" | |
7547 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7548 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7549 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7550 | { |
7551 | if (argc == 2) | |
7552 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
7553 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
7554 | ||
7555 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7556 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
7557 | } | |
7558 | ||
7559 | ALIAS (clear_bgp_peer_rsclient, | |
7560 | clear_bgp_ipv6_peer_rsclient_cmd, | |
a80beece | 7561 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7562 | CLEAR_STR |
7563 | BGP_STR | |
7564 | "Address family\n" | |
7565 | "BGP neighbor IP address to clear\n" | |
7566 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7567 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7568 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7569 | |
7570 | ALIAS (clear_bgp_peer_rsclient, | |
7571 | clear_bgp_instance_peer_rsclient_cmd, | |
a80beece | 7572 | "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7573 | CLEAR_STR |
7574 | BGP_STR | |
7575 | "BGP view\n" | |
7576 | "view name\n" | |
7577 | "BGP neighbor IP address to clear\n" | |
7578 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7579 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7580 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7581 | |
7582 | ALIAS (clear_bgp_peer_rsclient, | |
7583 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
a80beece | 7584 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7585 | CLEAR_STR |
7586 | BGP_STR | |
7587 | "Address family\n" | |
7588 | "BGP view\n" | |
7589 | "view name\n" | |
7590 | "BGP neighbor IP address to clear\n" | |
7591 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7592 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7593 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7594 | #endif /* HAVE_IPV6 */ |
7595 | ||
7596 | DEFUN (clear_ip_bgp_peer_rsclient, | |
7597 | clear_ip_bgp_peer_rsclient_cmd, | |
a80beece | 7598 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7599 | CLEAR_STR |
7600 | IP_STR | |
7601 | BGP_STR | |
7602 | "BGP neighbor IP address to clear\n" | |
7603 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7604 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7605 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7606 | { |
7607 | if (argc == 2) | |
7608 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
7609 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
7610 | ||
7611 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7612 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
7613 | } | |
7614 | ||
7615 | ALIAS (clear_ip_bgp_peer_rsclient, | |
7616 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
a80beece | 7617 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7618 | CLEAR_STR |
7619 | IP_STR | |
7620 | BGP_STR | |
7621 | "BGP view\n" | |
7622 | "view name\n" | |
7623 | "BGP neighbor IP address to clear\n" | |
7624 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7625 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7626 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7627 | |
e0081f70 ML |
7628 | DEFUN (show_bgp_views, |
7629 | show_bgp_views_cmd, | |
7630 | "show bgp views", | |
7631 | SHOW_STR | |
7632 | BGP_STR | |
7633 | "Show the defined BGP views\n") | |
7634 | { | |
7635 | struct list *inst = bm->bgp; | |
7636 | struct listnode *node; | |
7637 | struct bgp *bgp; | |
7638 | ||
7639 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
7640 | { | |
7641 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
7642 | return CMD_WARNING; | |
7643 | } | |
7644 | ||
7645 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
7646 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
7647 | vty_out (vty, "\t%s (AS%u)%s", | |
7648 | bgp->name ? bgp->name : "(null)", | |
7649 | bgp->as, VTY_NEWLINE); | |
7650 | ||
7651 | return CMD_SUCCESS; | |
7652 | } | |
7653 | ||
4bf6a362 PJ |
7654 | DEFUN (show_bgp_memory, |
7655 | show_bgp_memory_cmd, | |
7656 | "show bgp memory", | |
7657 | SHOW_STR | |
7658 | BGP_STR | |
7659 | "Global BGP memory statistics\n") | |
7660 | { | |
7661 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
7662 | unsigned long count; | |
7663 | ||
7664 | /* RIB related usage stats */ | |
7665 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
7666 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
7667 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7668 | count * sizeof (struct bgp_node)), | |
7669 | VTY_NEWLINE); | |
7670 | ||
7671 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
7672 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
7673 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7674 | count * sizeof (struct bgp_info)), | |
7675 | VTY_NEWLINE); | |
fb982c25 PJ |
7676 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
7677 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
7678 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7679 | count * sizeof (struct bgp_info_extra)), | |
7680 | VTY_NEWLINE); | |
4bf6a362 PJ |
7681 | |
7682 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
7683 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
7684 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7685 | count * sizeof (struct bgp_static)), | |
7686 | VTY_NEWLINE); | |
7687 | ||
7688 | /* Adj-In/Out */ | |
7689 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
7690 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
7691 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7692 | count * sizeof (struct bgp_adj_in)), | |
7693 | VTY_NEWLINE); | |
7694 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
7695 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
7696 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7697 | count * sizeof (struct bgp_adj_out)), | |
7698 | VTY_NEWLINE); | |
7699 | ||
7700 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
7701 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
7702 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7703 | count * sizeof (struct bgp_nexthop_cache)), | |
7704 | VTY_NEWLINE); | |
7705 | ||
7706 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
7707 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
7708 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7709 | count * sizeof (struct bgp_damp_info)), | |
7710 | VTY_NEWLINE); | |
7711 | ||
7712 | /* Attributes */ | |
7713 | count = attr_count(); | |
7714 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
7715 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7716 | count * sizeof(struct attr)), | |
7717 | VTY_NEWLINE); | |
fb982c25 PJ |
7718 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
7719 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
7720 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7721 | count * sizeof(struct attr_extra)), | |
7722 | VTY_NEWLINE); | |
4bf6a362 PJ |
7723 | |
7724 | if ((count = attr_unknown_count())) | |
7725 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
7726 | ||
7727 | /* AS_PATH attributes */ | |
7728 | count = aspath_count (); | |
7729 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
7730 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7731 | count * sizeof (struct aspath)), | |
7732 | VTY_NEWLINE); | |
7733 | ||
7734 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
7735 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
7736 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7737 | count * sizeof (struct assegment)), | |
7738 | VTY_NEWLINE); | |
7739 | ||
7740 | /* Other attributes */ | |
7741 | if ((count = community_count ())) | |
7742 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
7743 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7744 | count * sizeof (struct community)), | |
7745 | VTY_NEWLINE); | |
7746 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
7747 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
7748 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7749 | count * sizeof (struct ecommunity)), | |
7750 | VTY_NEWLINE); | |
7751 | ||
7752 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
7753 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
7754 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7755 | count * sizeof (struct cluster_list)), | |
7756 | VTY_NEWLINE); | |
7757 | ||
7758 | /* Peer related usage */ | |
7759 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
7760 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
7761 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7762 | count * sizeof (struct peer)), | |
7763 | VTY_NEWLINE); | |
7764 | ||
7765 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) | |
7766 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, | |
7767 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7768 | count * sizeof (struct peer_group)), | |
7769 | VTY_NEWLINE); | |
7770 | ||
7771 | /* Other */ | |
7772 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
7773 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
7774 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7775 | count * sizeof (struct hash)), | |
7776 | VTY_NEWLINE); | |
7777 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
7778 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
7779 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7780 | count * sizeof (struct hash_backet)), | |
7781 | VTY_NEWLINE); | |
7782 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
7783 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
7784 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7785 | count * sizeof (regex_t)), | |
7786 | VTY_NEWLINE); | |
7787 | return CMD_SUCCESS; | |
7788 | } | |
fee0f4c6 | 7789 | |
47fc97cc DS |
7790 | static int |
7791 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
7792 | { | |
7793 | struct bgp_table *table; | |
7794 | struct bgp_node *rn; | |
7795 | struct bgp_adj_out *adj; | |
7796 | int count = 0; | |
7797 | ||
7798 | if (!peer) return(0); | |
7799 | ||
7800 | table = peer->bgp->rib[afi][safi]; | |
7801 | if (!table) return(0); | |
7802 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
7803 | if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn)) | |
7804 | count++; | |
7805 | return (count); | |
7806 | } | |
7807 | ||
718e3744 | 7808 | /* Show BGP peer's summary information. */ |
94f2b392 | 7809 | static int |
47fc97cc | 7810 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, char *delimit) |
718e3744 | 7811 | { |
7812 | struct peer *peer; | |
1eb8ef25 | 7813 | struct listnode *node, *nnode; |
4bf6a362 | 7814 | unsigned int count = 0; |
718e3744 | 7815 | char timebuf[BGP_UPTIME_LEN]; |
7816 | int len; | |
7817 | ||
7818 | /* Header string for each address family. */ | |
7819 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc DS |
7820 | static char header_csv[] = "Neighbor, V, AS, MsgRcvd, MsgSent, TblVer, InQ, OutQ, Up/Down, State/PfxRcd, PfxAdv"; |
7821 | ||
1eb8ef25 | 7822 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 7823 | { |
1ff9a340 DS |
7824 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
7825 | continue; | |
7826 | ||
718e3744 | 7827 | if (peer->afc[afi][safi]) |
7828 | { | |
47fc97cc DS |
7829 | if (delimit) |
7830 | { | |
7831 | if (!count) | |
7832 | { | |
7833 | vty_out (vty, "%s%s", header_csv, VTY_NEWLINE); | |
7834 | } | |
7835 | } | |
7836 | else if (!count) | |
4bf6a362 PJ |
7837 | { |
7838 | unsigned long ents; | |
7839 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
7840 | ||
7841 | /* Usage summary and header */ | |
7842 | vty_out (vty, | |
aea339f7 | 7843 | "BGP router identifier %s, local AS number %u%s", |
4bf6a362 | 7844 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
f188f2c4 DS |
7845 | if (bgp_update_delay_configured(bgp)) |
7846 | { | |
7847 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", | |
7848 | bgp->v_update_delay, VTY_NEWLINE); | |
7849 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
7850 | vty_out (vty, " Establish wait: %d seconds%s", | |
7851 | bgp->v_establish_wait, VTY_NEWLINE); | |
7852 | if (bgp_update_delay_active(bgp)) | |
7853 | { | |
7854 | vty_out (vty, " First neighbor established: %s%s", | |
7855 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
7856 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); | |
7857 | } | |
7858 | else | |
7859 | { | |
7860 | if (bgp->update_delay_over) | |
7861 | { | |
7862 | vty_out (vty, " First neighbor established: %s%s", | |
7863 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
4a16ae86 | 7864 | vty_out (vty, " Best-paths resumed: %s%s", |
f188f2c4 | 7865 | bgp->update_delay_end_time, VTY_NEWLINE); |
4a16ae86 DS |
7866 | vty_out (vty, " zebra update resumed: %s%s", |
7867 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
7868 | vty_out (vty, " peers update resumed: %s%s", | |
7869 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
f188f2c4 DS |
7870 | } |
7871 | } | |
7872 | } | |
4bf6a362 | 7873 | |
abc920f8 DS |
7874 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) |
7875 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
7876 | if (bgp->v_maxmed_admin) | |
7877 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
7878 | ||
4bf6a362 PJ |
7879 | ents = bgp_table_count (bgp->rib[afi][safi]); |
7880 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
7881 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7882 | ents * sizeof (struct bgp_node)), | |
7883 | VTY_NEWLINE); | |
7884 | ||
7885 | /* Peer related usage */ | |
7886 | ents = listcount (bgp->peer); | |
7887 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
7888 | ents, | |
7889 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7890 | ents * sizeof (struct peer)), | |
7891 | VTY_NEWLINE); | |
7892 | ||
7893 | if ((ents = listcount (bgp->rsclient))) | |
7894 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
7895 | ents, | |
7896 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7897 | ents * sizeof (struct peer)), | |
7898 | VTY_NEWLINE); | |
7899 | ||
7900 | if ((ents = listcount (bgp->group))) | |
7901 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
7902 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7903 | ents * sizeof (struct peer_group)), | |
7904 | VTY_NEWLINE); | |
7905 | ||
7906 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
7907 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
7908 | vty_out (vty, "%s", VTY_NEWLINE); | |
7909 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
7910 | } | |
7911 | ||
718e3744 | 7912 | count++; |
7913 | ||
7914 | len = vty_out (vty, "%s", peer->host); | |
7915 | len = 16 - len; | |
7916 | if (len < 1) | |
7917 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
7918 | else | |
7919 | vty_out (vty, "%*s", len, " "); | |
7920 | ||
47fc97cc DS |
7921 | if (delimit) |
7922 | vty_out(vty, "%c", *delimit); | |
718e3744 | 7923 | |
47fc97cc | 7924 | vty_out (vty, "4 "); |
718e3744 | 7925 | |
47fc97cc DS |
7926 | if (delimit) |
7927 | vty_out(vty, "%c", *delimit); | |
7928 | ||
7929 | if (!delimit) | |
e4af2c1f | 7930 | vty_out (vty, "%5u %7d %7d %8d %4d %4u ", |
47fc97cc DS |
7931 | peer->as, |
7932 | peer->open_in + peer->update_in + peer->keepalive_in | |
7933 | + peer->notify_in + peer->refresh_in | |
7934 | + peer->dynamic_cap_in, | |
7935 | peer->open_out + peer->update_out + peer->keepalive_out | |
7936 | + peer->notify_out + peer->refresh_out | |
7937 | + peer->dynamic_cap_out, | |
7938 | 0, | |
7939 | 0, | |
cdabb8b6 DS |
7940 | peer->sync[afi][safi]->update.count + |
7941 | peer->sync[afi][safi]->withdraw.count); | |
47fc97cc | 7942 | else |
e4af2c1f | 7943 | vty_out (vty, "%5u %c %7d %c %7d %c %8d %c %4d %c %4u %c", |
47fc97cc DS |
7944 | peer->as, *delimit, |
7945 | peer->open_in + peer->update_in + peer->keepalive_in | |
7946 | + peer->notify_in + peer->refresh_in | |
7947 | + peer->dynamic_cap_in, *delimit, | |
7948 | peer->open_out + peer->update_out + peer->keepalive_out | |
7949 | + peer->notify_out + peer->refresh_out | |
7950 | + peer->dynamic_cap_out, *delimit, | |
7951 | 0, *delimit, | |
7952 | 0, *delimit, | |
cdabb8b6 DS |
7953 | peer->sync[afi][safi]->update.count + |
7954 | peer->sync[afi][safi]->withdraw.count, *delimit); | |
47fc97cc DS |
7955 | |
7956 | vty_out (vty, "%8s", | |
718e3744 | 7957 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
47fc97cc DS |
7958 | if (delimit) |
7959 | vty_out(vty, "%c", *delimit); | |
718e3744 | 7960 | |
7961 | if (peer->status == Established) | |
718e3744 | 7962 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
718e3744 | 7963 | else |
7964 | { | |
7965 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
7966 | vty_out (vty, " Idle (Admin)"); | |
7967 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
7968 | vty_out (vty, " Idle (PfxCt)"); | |
7969 | else | |
7970 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
7971 | } | |
47fc97cc DS |
7972 | if (delimit) |
7973 | vty_out(vty, ", %d", bgp_adj_out_count(peer, afi, safi)); | |
718e3744 | 7974 | |
7975 | vty_out (vty, "%s", VTY_NEWLINE); | |
7976 | } | |
7977 | } | |
7978 | ||
7979 | if (count) | |
7980 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
7981 | count, VTY_NEWLINE); | |
7982 | else | |
7983 | vty_out (vty, "No %s neighbor is configured%s", | |
7984 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
f188f2c4 | 7985 | |
718e3744 | 7986 | return CMD_SUCCESS; |
7987 | } | |
7988 | ||
47fc97cc DS |
7989 | static int |
7990 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
7991 | afi_t afi, safi_t safi, char *delimit) | |
718e3744 | 7992 | { |
7993 | struct bgp *bgp; | |
7994 | ||
7995 | if (name) | |
7996 | { | |
7997 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 7998 | |
718e3744 | 7999 | if (! bgp) |
8000 | { | |
47fc97cc | 8001 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 8002 | return CMD_WARNING; |
8003 | } | |
8004 | ||
47fc97cc | 8005 | bgp_show_summary (vty, bgp, afi, safi, delimit); |
718e3744 | 8006 | return CMD_SUCCESS; |
8007 | } | |
47fc97cc | 8008 | |
718e3744 | 8009 | bgp = bgp_get_default (); |
8010 | ||
8011 | if (bgp) | |
47fc97cc DS |
8012 | bgp_show_summary (vty, bgp, afi, safi, delimit); |
8013 | ||
718e3744 | 8014 | return CMD_SUCCESS; |
8015 | } | |
8016 | ||
8017 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 8018 | DEFUN (show_ip_bgp_summary, |
718e3744 | 8019 | show_ip_bgp_summary_cmd, |
8020 | "show ip bgp summary", | |
8021 | SHOW_STR | |
8022 | IP_STR | |
8023 | BGP_STR | |
8024 | "Summary of BGP neighbor status\n") | |
8025 | { | |
47fc97cc DS |
8026 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL); |
8027 | } | |
8028 | ||
8029 | DEFUN (show_ip_bgp_summary_csv, | |
8030 | show_ip_bgp_summary_csv_cmd, | |
8031 | "show ip bgp summary csv", | |
8032 | SHOW_STR | |
8033 | IP_STR | |
8034 | BGP_STR | |
8035 | "Summary of BGP neighbor status\n") | |
8036 | { | |
8037 | char csv = ','; | |
8038 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, &csv); | |
718e3744 | 8039 | } |
8040 | ||
8041 | DEFUN (show_ip_bgp_instance_summary, | |
8042 | show_ip_bgp_instance_summary_cmd, | |
8043 | "show ip bgp view WORD summary", | |
8044 | SHOW_STR | |
8045 | IP_STR | |
8046 | BGP_STR | |
8047 | "BGP view\n" | |
8048 | "View name\n" | |
8049 | "Summary of BGP neighbor status\n") | |
8050 | { | |
47fc97cc | 8051 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 8052 | } |
8053 | ||
8054 | DEFUN (show_ip_bgp_ipv4_summary, | |
8055 | show_ip_bgp_ipv4_summary_cmd, | |
8056 | "show ip bgp ipv4 (unicast|multicast) summary", | |
8057 | SHOW_STR | |
8058 | IP_STR | |
8059 | BGP_STR | |
8060 | "Address family\n" | |
8061 | "Address Family modifier\n" | |
8062 | "Address Family modifier\n" | |
8063 | "Summary of BGP neighbor status\n") | |
8064 | { | |
8065 | if (strncmp (argv[0], "m", 1) == 0) | |
47fc97cc | 8066 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, NULL); |
718e3744 | 8067 | |
47fc97cc | 8068 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 8069 | } |
8070 | ||
95cbbd2a ML |
8071 | ALIAS (show_ip_bgp_ipv4_summary, |
8072 | show_bgp_ipv4_safi_summary_cmd, | |
8073 | "show bgp ipv4 (unicast|multicast) summary", | |
8074 | SHOW_STR | |
8075 | BGP_STR | |
8076 | "Address family\n" | |
8077 | "Address Family modifier\n" | |
8078 | "Address Family modifier\n" | |
8079 | "Summary of BGP neighbor status\n") | |
8080 | ||
718e3744 | 8081 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
8082 | show_ip_bgp_instance_ipv4_summary_cmd, | |
8083 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", | |
8084 | SHOW_STR | |
8085 | IP_STR | |
8086 | BGP_STR | |
8087 | "BGP view\n" | |
8088 | "View name\n" | |
8089 | "Address family\n" | |
8090 | "Address Family modifier\n" | |
8091 | "Address Family modifier\n" | |
8092 | "Summary of BGP neighbor status\n") | |
8093 | { | |
8094 | if (strncmp (argv[1], "m", 1) == 0) | |
47fc97cc | 8095 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, NULL); |
718e3744 | 8096 | else |
47fc97cc | 8097 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 8098 | } |
8099 | ||
95cbbd2a ML |
8100 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
8101 | show_bgp_instance_ipv4_safi_summary_cmd, | |
8102 | "show bgp view WORD ipv4 (unicast|multicast) summary", | |
8103 | SHOW_STR | |
8104 | BGP_STR | |
8105 | "BGP view\n" | |
8106 | "View name\n" | |
8107 | "Address family\n" | |
8108 | "Address Family modifier\n" | |
8109 | "Address Family modifier\n" | |
8110 | "Summary of BGP neighbor status\n") | |
8111 | ||
718e3744 | 8112 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
8113 | show_ip_bgp_vpnv4_all_summary_cmd, | |
8114 | "show ip bgp vpnv4 all summary", | |
8115 | SHOW_STR | |
8116 | IP_STR | |
8117 | BGP_STR | |
8118 | "Display VPNv4 NLRI specific information\n" | |
8119 | "Display information about all VPNv4 NLRIs\n" | |
8120 | "Summary of BGP neighbor status\n") | |
8121 | { | |
47fc97cc | 8122 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL); |
718e3744 | 8123 | } |
8124 | ||
8125 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
8126 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
8127 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", | |
8128 | SHOW_STR | |
8129 | IP_STR | |
8130 | BGP_STR | |
8131 | "Display VPNv4 NLRI specific information\n" | |
8132 | "Display information for a route distinguisher\n" | |
8133 | "VPN Route Distinguisher\n" | |
8134 | "Summary of BGP neighbor status\n") | |
8135 | { | |
8136 | int ret; | |
8137 | struct prefix_rd prd; | |
8138 | ||
8139 | ret = str2prefix_rd (argv[0], &prd); | |
8140 | if (! ret) | |
8141 | { | |
8142 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
8143 | return CMD_WARNING; | |
8144 | } | |
8145 | ||
47fc97cc | 8146 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL); |
718e3744 | 8147 | } |
8148 | ||
8149 | #ifdef HAVE_IPV6 | |
47fc97cc | 8150 | DEFUN (show_bgp_summary, |
718e3744 | 8151 | show_bgp_summary_cmd, |
8152 | "show bgp summary", | |
8153 | SHOW_STR | |
8154 | BGP_STR | |
8155 | "Summary of BGP neighbor status\n") | |
8156 | { | |
47fc97cc DS |
8157 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
8158 | } | |
8159 | ||
8160 | DEFUN (show_bgp_summary_csv, | |
8161 | show_bgp_summary_csv_cmd, | |
8162 | "show bgp summary csv", | |
8163 | SHOW_STR | |
8164 | BGP_STR | |
8165 | "Summary of BGP neighbor status\n") | |
8166 | { | |
8167 | char csv = ','; | |
8168 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, &csv); | |
718e3744 | 8169 | } |
8170 | ||
8171 | DEFUN (show_bgp_instance_summary, | |
8172 | show_bgp_instance_summary_cmd, | |
8173 | "show bgp view WORD summary", | |
8174 | SHOW_STR | |
8175 | BGP_STR | |
8176 | "BGP view\n" | |
8177 | "View name\n" | |
8178 | "Summary of BGP neighbor status\n") | |
8179 | { | |
47fc97cc | 8180 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL); |
718e3744 | 8181 | } |
8182 | ||
8183 | ALIAS (show_bgp_summary, | |
8184 | show_bgp_ipv6_summary_cmd, | |
8185 | "show bgp ipv6 summary", | |
8186 | SHOW_STR | |
8187 | BGP_STR | |
8188 | "Address family\n" | |
8189 | "Summary of BGP neighbor status\n") | |
8190 | ||
8191 | ALIAS (show_bgp_instance_summary, | |
8192 | show_bgp_instance_ipv6_summary_cmd, | |
8193 | "show bgp view WORD ipv6 summary", | |
8194 | SHOW_STR | |
8195 | BGP_STR | |
8196 | "BGP view\n" | |
8197 | "View name\n" | |
8198 | "Address family\n" | |
8199 | "Summary of BGP neighbor status\n") | |
8200 | ||
95cbbd2a ML |
8201 | DEFUN (show_bgp_ipv6_safi_summary, |
8202 | show_bgp_ipv6_safi_summary_cmd, | |
8203 | "show bgp ipv6 (unicast|multicast) summary", | |
8204 | SHOW_STR | |
8205 | BGP_STR | |
8206 | "Address family\n" | |
8207 | "Address Family modifier\n" | |
8208 | "Address Family modifier\n" | |
8209 | "Summary of BGP neighbor status\n") | |
8210 | { | |
8211 | if (strncmp (argv[0], "m", 1) == 0) | |
47fc97cc | 8212 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL); |
95cbbd2a | 8213 | |
47fc97cc | 8214 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
95cbbd2a ML |
8215 | } |
8216 | ||
8217 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
8218 | show_bgp_instance_ipv6_safi_summary_cmd, | |
8219 | "show bgp view WORD ipv6 (unicast|multicast) summary", | |
8220 | SHOW_STR | |
8221 | BGP_STR | |
8222 | "BGP view\n" | |
8223 | "View name\n" | |
8224 | "Address family\n" | |
8225 | "Address Family modifier\n" | |
8226 | "Address Family modifier\n" | |
8227 | "Summary of BGP neighbor status\n") | |
8228 | { | |
8229 | if (strncmp (argv[1], "m", 1) == 0) | |
47fc97cc | 8230 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, NULL); |
95cbbd2a | 8231 | |
47fc97cc | 8232 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL); |
95cbbd2a ML |
8233 | } |
8234 | ||
718e3744 | 8235 | /* old command */ |
8236 | DEFUN (show_ipv6_bgp_summary, | |
8237 | show_ipv6_bgp_summary_cmd, | |
8238 | "show ipv6 bgp summary", | |
8239 | SHOW_STR | |
8240 | IPV6_STR | |
8241 | BGP_STR | |
8242 | "Summary of BGP neighbor status\n") | |
8243 | { | |
47fc97cc | 8244 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
718e3744 | 8245 | } |
8246 | ||
8247 | /* old command */ | |
8248 | DEFUN (show_ipv6_mbgp_summary, | |
8249 | show_ipv6_mbgp_summary_cmd, | |
8250 | "show ipv6 mbgp summary", | |
8251 | SHOW_STR | |
8252 | IPV6_STR | |
8253 | MBGP_STR | |
8254 | "Summary of BGP neighbor status\n") | |
8255 | { | |
47fc97cc | 8256 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL); |
718e3744 | 8257 | } |
8258 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 8259 | |
fd79ac91 | 8260 | const char * |
538621f2 | 8261 | afi_safi_print (afi_t afi, safi_t safi) |
8262 | { | |
8263 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
8264 | return "IPv4 Unicast"; | |
8265 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
8266 | return "IPv4 Multicast"; | |
8267 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
8268 | return "VPNv4 Unicast"; | |
8269 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
8270 | return "IPv6 Unicast"; | |
8271 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
8272 | return "IPv6 Multicast"; | |
8273 | else | |
8274 | return "Unknown"; | |
8275 | } | |
8276 | ||
718e3744 | 8277 | /* Show BGP peer's information. */ |
8278 | enum show_type | |
8279 | { | |
8280 | show_all, | |
8281 | show_peer | |
8282 | }; | |
8283 | ||
94f2b392 | 8284 | static void |
718e3744 | 8285 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
8286 | afi_t afi, safi_t safi, | |
8287 | u_int16_t adv_smcap, u_int16_t adv_rmcap, | |
8288 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) | |
8289 | { | |
8290 | /* Send-Mode */ | |
8291 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
8292 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8293 | { | |
8294 | vty_out (vty, " Send-mode: "); | |
8295 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
8296 | vty_out (vty, "advertised"); | |
8297 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8298 | vty_out (vty, "%sreceived", | |
8299 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
8300 | ", " : ""); | |
8301 | vty_out (vty, "%s", VTY_NEWLINE); | |
8302 | } | |
8303 | ||
8304 | /* Receive-Mode */ | |
8305 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
8306 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8307 | { | |
8308 | vty_out (vty, " Receive-mode: "); | |
8309 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
8310 | vty_out (vty, "advertised"); | |
8311 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8312 | vty_out (vty, "%sreceived", | |
8313 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
8314 | ", " : ""); | |
8315 | vty_out (vty, "%s", VTY_NEWLINE); | |
8316 | } | |
8317 | } | |
8318 | ||
94f2b392 | 8319 | static void |
718e3744 | 8320 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
8321 | { | |
8322 | struct bgp_filter *filter; | |
8323 | char orf_pfx_name[BUFSIZ]; | |
8324 | int orf_pfx_count; | |
8325 | ||
8326 | filter = &p->filter[afi][safi]; | |
8327 | ||
538621f2 | 8328 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
718e3744 | 8329 | VTY_NEWLINE); |
538621f2 | 8330 | |
718e3744 | 8331 | if (p->af_group[afi][safi]) |
8332 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
8333 | ||
8334 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8335 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
8336 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
8337 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8338 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
8339 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
8340 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
8341 | ||
8342 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8343 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
8344 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8345 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
8346 | { | |
8347 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
8348 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
8349 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
8350 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
8351 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
8352 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
8353 | PEER_CAP_ORF_PREFIX_RM_RCV); | |
8354 | } | |
8355 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8356 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
8357 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8358 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
8359 | { | |
8360 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
8361 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
8362 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
8363 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
8364 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
8365 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
8366 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); | |
8367 | } | |
8368 | ||
8369 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
8370 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); | |
8371 | ||
8372 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
8373 | || orf_pfx_count) | |
8374 | { | |
8375 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
8376 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
8377 | vty_out (vty, " sent;"); | |
8378 | if (orf_pfx_count) | |
8379 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
8380 | vty_out (vty, "%s", VTY_NEWLINE); | |
8381 | } | |
8382 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
8383 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
8384 | ||
8385 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
8386 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
8387 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
8388 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
8389 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
8390 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
5000f21c DS |
8391 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) |
8392 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); | |
8393 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
8394 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
8395 | ||
c7122e14 DS |
8396 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
8397 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
8398 | ||
5000f21c DS |
8399 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || |
8400 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF_ALL)) | |
718e3744 | 8401 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
8402 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
8403 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
8404 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
8405 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
8406 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
8407 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
8408 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
8409 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
8410 | { | |
8411 | vty_out (vty, " Community attribute sent to this neighbor"); | |
8412 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
8413 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
538621f2 | 8414 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
718e3744 | 8415 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
538621f2 | 8416 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
718e3744 | 8417 | else |
538621f2 | 8418 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
718e3744 | 8419 | } |
8420 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
8421 | { | |
8422 | vty_out (vty, " Default information originate,"); | |
8423 | ||
8424 | if (p->default_rmap[afi][safi].name) | |
8425 | vty_out (vty, " default route-map %s%s,", | |
8426 | p->default_rmap[afi][safi].map ? "*" : "", | |
8427 | p->default_rmap[afi][safi].name); | |
8428 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) | |
8429 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
8430 | else | |
8431 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
8432 | } | |
8433 | ||
8434 | if (filter->plist[FILTER_IN].name | |
8435 | || filter->dlist[FILTER_IN].name | |
8436 | || filter->aslist[FILTER_IN].name | |
fee0f4c6 | 8437 | || filter->map[RMAP_IN].name) |
718e3744 | 8438 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
8439 | if (filter->plist[FILTER_OUT].name | |
8440 | || filter->dlist[FILTER_OUT].name | |
8441 | || filter->aslist[FILTER_OUT].name | |
fee0f4c6 | 8442 | || filter->map[RMAP_OUT].name |
718e3744 | 8443 | || filter->usmap.name) |
8444 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
fee0f4c6 | 8445 | if (filter->map[RMAP_IMPORT].name) |
8446 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
8447 | if (filter->map[RMAP_EXPORT].name) | |
8448 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
718e3744 | 8449 | |
8450 | /* prefix-list */ | |
8451 | if (filter->plist[FILTER_IN].name) | |
8452 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
8453 | filter->plist[FILTER_IN].plist ? "*" : "", | |
8454 | filter->plist[FILTER_IN].name, | |
8455 | VTY_NEWLINE); | |
8456 | if (filter->plist[FILTER_OUT].name) | |
8457 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
8458 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
8459 | filter->plist[FILTER_OUT].name, | |
8460 | VTY_NEWLINE); | |
8461 | ||
8462 | /* distribute-list */ | |
8463 | if (filter->dlist[FILTER_IN].name) | |
8464 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
8465 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
8466 | filter->dlist[FILTER_IN].name, | |
8467 | VTY_NEWLINE); | |
8468 | if (filter->dlist[FILTER_OUT].name) | |
8469 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
8470 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
8471 | filter->dlist[FILTER_OUT].name, | |
8472 | VTY_NEWLINE); | |
8473 | ||
8474 | /* filter-list. */ | |
8475 | if (filter->aslist[FILTER_IN].name) | |
8476 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
8477 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
8478 | filter->aslist[FILTER_IN].name, | |
8479 | VTY_NEWLINE); | |
8480 | if (filter->aslist[FILTER_OUT].name) | |
8481 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
8482 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
8483 | filter->aslist[FILTER_OUT].name, | |
8484 | VTY_NEWLINE); | |
8485 | ||
8486 | /* route-map. */ | |
fee0f4c6 | 8487 | if (filter->map[RMAP_IN].name) |
718e3744 | 8488 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
fee0f4c6 | 8489 | filter->map[RMAP_IN].map ? "*" : "", |
8490 | filter->map[RMAP_IN].name, | |
718e3744 | 8491 | VTY_NEWLINE); |
fee0f4c6 | 8492 | if (filter->map[RMAP_OUT].name) |
718e3744 | 8493 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
fee0f4c6 | 8494 | filter->map[RMAP_OUT].map ? "*" : "", |
8495 | filter->map[RMAP_OUT].name, | |
8496 | VTY_NEWLINE); | |
8497 | if (filter->map[RMAP_IMPORT].name) | |
8498 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
8499 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
8500 | filter->map[RMAP_IMPORT].name, | |
8501 | VTY_NEWLINE); | |
8502 | if (filter->map[RMAP_EXPORT].name) | |
8503 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
8504 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
8505 | filter->map[RMAP_EXPORT].name, | |
718e3744 | 8506 | VTY_NEWLINE); |
8507 | ||
8508 | /* unsuppress-map */ | |
8509 | if (filter->usmap.name) | |
8510 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
8511 | filter->usmap.map ? "*" : "", | |
8512 | filter->usmap.name, VTY_NEWLINE); | |
8513 | ||
8514 | /* Receive prefix count */ | |
e0701b79 | 8515 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
8516 | ||
718e3744 | 8517 | /* Maximum prefix */ |
8518 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
8519 | { | |
0a486e5f | 8520 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
718e3744 | 8521 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
0a486e5f | 8522 | ? " (warning-only)" : "", VTY_NEWLINE); |
8523 | vty_out (vty, " Threshold for warning message %d%%", | |
8524 | p->pmax_threshold[afi][safi]); | |
8525 | if (p->pmax_restart[afi][safi]) | |
8526 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
8527 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 8528 | } |
718e3744 | 8529 | |
8530 | vty_out (vty, "%s", VTY_NEWLINE); | |
8531 | } | |
8532 | ||
94f2b392 | 8533 | static void |
718e3744 | 8534 | bgp_show_peer (struct vty *vty, struct peer *p) |
8535 | { | |
8536 | struct bgp *bgp; | |
a80beece | 8537 | char buf1[BUFSIZ], buf[SU_ADDRSTRLEN]; |
718e3744 | 8538 | char timebuf[BGP_UPTIME_LEN]; |
538621f2 | 8539 | afi_t afi; |
8540 | safi_t safi; | |
d6661008 DS |
8541 | u_int16_t i; |
8542 | u_char *msg; | |
718e3744 | 8543 | |
8544 | bgp = p->bgp; | |
8545 | ||
a80beece DS |
8546 | if (p->conf_if) /* Configured interface name. */ |
8547 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
8548 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
8549 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
8550 | else /* Configured IP address. */ | |
8551 | vty_out (vty, "BGP neighbor is %s, ", p->host); | |
aea339f7 | 8552 | vty_out (vty, "remote AS %u, ", p->as); |
9d3f9705 | 8553 | vty_out (vty, "local AS %u%s%s, ", |
718e3744 | 8554 | p->change_local_as ? p->change_local_as : p->local_as, |
8555 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9d3f9705 AC |
8556 | " no-prepend" : "", |
8557 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
8558 | " replace-as" : ""); | |
718e3744 | 8559 | vty_out (vty, "%s link%s", |
8560 | p->as == p->local_as ? "internal" : "external", | |
8561 | VTY_NEWLINE); | |
8562 | ||
8563 | /* Description. */ | |
8564 | if (p->desc) | |
8565 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
8566 | ||
8567 | /* Peer-group */ | |
8568 | if (p->group) | |
8569 | vty_out (vty, " Member of peer-group %s for session parameters%s", | |
8570 | p->group->name, VTY_NEWLINE); | |
8571 | ||
8572 | /* Administrative shutdown. */ | |
8573 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
8574 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
8575 | ||
8576 | /* BGP Version. */ | |
8577 | vty_out (vty, " BGP version 4"); | |
718e3744 | 8578 | vty_out (vty, ", remote router ID %s%s", |
8579 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
8580 | VTY_NEWLINE); | |
8581 | ||
8582 | /* Confederation */ | |
e0701b79 | 8583 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
8584 | && bgp_confederation_peers_check (bgp, p->as)) | |
718e3744 | 8585 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
8586 | ||
8587 | /* Status. */ | |
8588 | vty_out (vty, " BGP state = %s", | |
8589 | LOOKUP (bgp_status_msg, p->status)); | |
8590 | if (p->status == Established) | |
8591 | vty_out (vty, ", up for %8s", | |
8592 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); | |
93406d87 | 8593 | else if (p->status == Active) |
8594 | { | |
8595 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
8596 | vty_out (vty, " (passive)"); | |
8597 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
8598 | vty_out (vty, " (NSF passive)"); | |
8599 | } | |
718e3744 | 8600 | vty_out (vty, "%s", VTY_NEWLINE); |
8601 | ||
8602 | /* read timer */ | |
8603 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); | |
cb1faec9 DS |
8604 | vty_out (vty, ", Last write %s%s", |
8605 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN), VTY_NEWLINE); | |
718e3744 | 8606 | |
8607 | /* Configured timer values. */ | |
cb1faec9 | 8608 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", |
718e3744 | 8609 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
8610 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
8611 | { | |
8612 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
8613 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
8614 | p->keepalive, VTY_NEWLINE); | |
8615 | } | |
93406d87 | 8616 | |
718e3744 | 8617 | /* Capability. */ |
8618 | if (p->status == Established) | |
8619 | { | |
538621f2 | 8620 | if (p->cap |
718e3744 | 8621 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
8622 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
8623 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
8624 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
8625 | #ifdef HAVE_IPV6 | |
8626 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
8627 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
8628 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
8629 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
8630 | #endif /* HAVE_IPV6 */ | |
8631 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
8632 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
8633 | { | |
8634 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
8635 | ||
0b2aa3a0 PJ |
8636 | /* AS4 */ |
8637 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
8638 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
8639 | { | |
8640 | vty_out (vty, " 4 Byte AS:"); | |
8641 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
8642 | vty_out (vty, " advertised"); | |
8643 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
8644 | vty_out (vty, " %sreceived", | |
8645 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
8646 | vty_out (vty, "%s", VTY_NEWLINE); | |
8647 | } | |
718e3744 | 8648 | /* Dynamic */ |
8649 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
8650 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
8651 | { | |
8652 | vty_out (vty, " Dynamic:"); | |
8653 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
8654 | vty_out (vty, " advertised"); | |
8655 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
538621f2 | 8656 | vty_out (vty, " %sreceived", |
8657 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
718e3744 | 8658 | vty_out (vty, "%s", VTY_NEWLINE); |
8659 | } | |
8660 | ||
8661 | /* Route Refresh */ | |
8662 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
8663 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
8664 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
8665 | { | |
8666 | vty_out (vty, " Route refresh:"); | |
8667 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
8668 | vty_out (vty, " advertised"); | |
8669 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
8670 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
538621f2 | 8671 | vty_out (vty, " %sreceived(%s)", |
8672 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
8673 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
8674 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
8675 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
718e3744 | 8676 | |
718e3744 | 8677 | vty_out (vty, "%s", VTY_NEWLINE); |
8678 | } | |
538621f2 | 8679 | |
8680 | /* Multiprotocol Extensions */ | |
8681 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8682 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8683 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
718e3744 | 8684 | { |
538621f2 | 8685 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
8686 | if (p->afc_adv[afi][safi]) | |
8687 | vty_out (vty, " advertised"); | |
8688 | if (p->afc_recv[afi][safi]) | |
8689 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
8690 | vty_out (vty, "%s", VTY_NEWLINE); | |
8691 | } | |
8692 | ||
8693 | /* Gracefull Restart */ | |
8694 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
8695 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 8696 | { |
538621f2 | 8697 | vty_out (vty, " Graceful Restart Capabilty:"); |
8698 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 8699 | vty_out (vty, " advertised"); |
538621f2 | 8700 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
8701 | vty_out (vty, " %sreceived", | |
8702 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
718e3744 | 8703 | vty_out (vty, "%s", VTY_NEWLINE); |
538621f2 | 8704 | |
8705 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
718e3744 | 8706 | { |
538621f2 | 8707 | int restart_af_count = 0; |
8708 | ||
8709 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
93406d87 | 8710 | p->v_gr_restart, VTY_NEWLINE); |
8711 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
538621f2 | 8712 | |
8713 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8714 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8715 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
8716 | { | |
93406d87 | 8717 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
8718 | afi_safi_print (afi, safi), | |
8719 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
8720 | "preserved" : "not preserved"); | |
538621f2 | 8721 | restart_af_count++; |
93406d87 | 8722 | } |
538621f2 | 8723 | if (! restart_af_count) |
8724 | vty_out (vty, "none"); | |
8725 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 8726 | } |
718e3744 | 8727 | } |
718e3744 | 8728 | } |
8729 | } | |
8730 | ||
93406d87 | 8731 | /* graceful restart information */ |
8732 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
8733 | || p->t_gr_restart | |
8734 | || p->t_gr_stale) | |
8735 | { | |
8736 | int eor_send_af_count = 0; | |
8737 | int eor_receive_af_count = 0; | |
8738 | ||
8739 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
8740 | if (p->status == Established) | |
8741 | { | |
8742 | vty_out (vty, " End-of-RIB send: "); | |
8743 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8744 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8745 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
8746 | { | |
8747 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
8748 | afi_safi_print (afi, safi)); | |
8749 | eor_send_af_count++; | |
8750 | } | |
8751 | vty_out (vty, "%s", VTY_NEWLINE); | |
8752 | ||
8753 | vty_out (vty, " End-of-RIB received: "); | |
8754 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8755 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8756 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
8757 | { | |
8758 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
8759 | afi_safi_print (afi, safi)); | |
8760 | eor_receive_af_count++; | |
8761 | } | |
8762 | vty_out (vty, "%s", VTY_NEWLINE); | |
8763 | } | |
8764 | ||
8765 | if (p->t_gr_restart) | |
0b2aa3a0 PJ |
8766 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
8767 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
8768 | ||
93406d87 | 8769 | if (p->t_gr_stale) |
0b2aa3a0 PJ |
8770 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
8771 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
93406d87 | 8772 | } |
8773 | ||
718e3744 | 8774 | /* Packet counts. */ |
93406d87 | 8775 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
8776 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
0b2aa3a0 | 8777 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); |
93406d87 | 8778 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
8779 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
8780 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
8781 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
8782 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
8783 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
8784 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
8785 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
8786 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
8787 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
8788 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 8789 | |
8790 | /* advertisement-interval */ | |
8791 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
8792 | p->v_routeadv, VTY_NEWLINE); | |
8793 | ||
8794 | /* Update-source. */ | |
8795 | if (p->update_if || p->update_source) | |
8796 | { | |
8797 | vty_out (vty, " Update source is "); | |
8798 | if (p->update_if) | |
8799 | vty_out (vty, "%s", p->update_if); | |
8800 | else if (p->update_source) | |
8801 | vty_out (vty, "%s", | |
8802 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
8803 | vty_out (vty, "%s", VTY_NEWLINE); | |
8804 | } | |
8805 | ||
8806 | /* Default weight */ | |
8807 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
8808 | vty_out (vty, " Default weight %d%s", p->weight, | |
8809 | VTY_NEWLINE); | |
8810 | ||
8811 | vty_out (vty, "%s", VTY_NEWLINE); | |
8812 | ||
8813 | /* Address Family Information */ | |
538621f2 | 8814 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
8815 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8816 | if (p->afc[afi][safi]) | |
8817 | bgp_show_peer_afi (vty, p, afi, safi); | |
718e3744 | 8818 | |
8819 | vty_out (vty, " Connections established %d; dropped %d%s", | |
8820 | p->established, p->dropped, | |
8821 | VTY_NEWLINE); | |
8822 | ||
d6661008 | 8823 | if (! p->last_reset) |
e0701b79 | 8824 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
8825 | else | |
d6661008 DS |
8826 | { |
8827 | vty_out (vty, " Last reset %s, due to %s%s", | |
8828 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), | |
8829 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
8830 | ||
8831 | if (p->last_reset_cause_size) | |
8832 | { | |
8833 | msg = p->last_reset_cause; | |
8834 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
8835 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
8836 | { | |
8837 | vty_out(vty, "%02X", *msg++); | |
8838 | ||
8839 | if (i != p->last_reset_cause_size) | |
8840 | if (i % 16 == 0) | |
8841 | vty_out(vty, "%s ", VTY_NEWLINE); | |
8842 | else if (i % 4 == 0) | |
8843 | vty_out(vty, " "); | |
8844 | } | |
8845 | vty_out(vty, "%s", VTY_NEWLINE); | |
8846 | } | |
8847 | } | |
848973c7 | 8848 | |
718e3744 | 8849 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
8850 | { | |
8851 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 8852 | |
8853 | if (p->t_pmax_restart) | |
8854 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
8855 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
8856 | VTY_NEWLINE); | |
8857 | else | |
8858 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
8859 | p->host, VTY_NEWLINE); | |
718e3744 | 8860 | } |
8861 | ||
f5a4827d | 8862 | /* EBGP Multihop and GTSM */ |
6d85b15b | 8863 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d SH |
8864 | { |
8865 | if (p->gtsm_hops > 0) | |
8866 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
8867 | p->gtsm_hops, VTY_NEWLINE); | |
8868 | else if (p->ttl > 1) | |
8869 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
8870 | p->ttl, VTY_NEWLINE); | |
8871 | } | |
5d804b43 PM |
8872 | else |
8873 | { | |
8874 | if (p->gtsm_hops > 0) | |
8875 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
8876 | p->gtsm_hops, VTY_NEWLINE); | |
8877 | } | |
718e3744 | 8878 | |
8879 | /* Local address. */ | |
8880 | if (p->su_local) | |
8881 | { | |
93406d87 | 8882 | vty_out (vty, "Local host: %s, Local port: %d%s", |
718e3744 | 8883 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
8884 | ntohs (p->su_local->sin.sin_port), | |
718e3744 | 8885 | VTY_NEWLINE); |
8886 | } | |
8887 | ||
8888 | /* Remote address. */ | |
8889 | if (p->su_remote) | |
8890 | { | |
8891 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
8892 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), | |
8893 | ntohs (p->su_remote->sin.sin_port), | |
8894 | VTY_NEWLINE); | |
8895 | } | |
8896 | ||
8897 | /* Nexthop display. */ | |
8898 | if (p->su_local) | |
8899 | { | |
8900 | vty_out (vty, "Nexthop: %s%s", | |
8901 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
8902 | VTY_NEWLINE); | |
8903 | #ifdef HAVE_IPV6 | |
8904 | vty_out (vty, "Nexthop global: %s%s", | |
8905 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
8906 | VTY_NEWLINE); | |
8907 | vty_out (vty, "Nexthop local: %s%s", | |
8908 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
8909 | VTY_NEWLINE); | |
8910 | vty_out (vty, "BGP connection: %s%s", | |
8911 | p->shared_network ? "shared network" : "non shared network", | |
8912 | VTY_NEWLINE); | |
8913 | #endif /* HAVE_IPV6 */ | |
8914 | } | |
8915 | ||
8916 | /* Timer information. */ | |
8917 | if (p->t_start) | |
8918 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
8919 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
8920 | if (p->t_connect) | |
8921 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
8922 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
cb1faec9 DS |
8923 | if (p->t_routeadv) |
8924 | vty_out (vty, "MRAI (interval %ld) timer expires in %ld seconds%s", | |
8925 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
8926 | VTY_NEWLINE); | |
8927 | ||
8928 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
718e3744 | 8929 | p->t_read ? "on" : "off", |
8930 | p->t_write ? "on" : "off", | |
8931 | VTY_NEWLINE); | |
8932 | ||
8933 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
8934 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
8935 | bgp_capability_vty_out (vty, p); | |
8936 | ||
8937 | vty_out (vty, "%s", VTY_NEWLINE); | |
8938 | } | |
8939 | ||
94f2b392 | 8940 | static int |
718e3744 | 8941 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
a80beece | 8942 | enum show_type type, union sockunion *su, const char *conf_if) |
718e3744 | 8943 | { |
1eb8ef25 | 8944 | struct listnode *node, *nnode; |
718e3744 | 8945 | struct peer *peer; |
8946 | int find = 0; | |
8947 | ||
1eb8ef25 | 8948 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8949 | { |
1ff9a340 DS |
8950 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
8951 | continue; | |
8952 | ||
718e3744 | 8953 | switch (type) |
8954 | { | |
8955 | case show_all: | |
8956 | bgp_show_peer (vty, peer); | |
8957 | break; | |
8958 | case show_peer: | |
a80beece DS |
8959 | if (conf_if) |
8960 | { | |
8961 | if (peer->conf_if && !strcmp(peer->conf_if, conf_if)) | |
8962 | { | |
8963 | find = 1; | |
8964 | bgp_show_peer (vty, peer); | |
8965 | } | |
8966 | } | |
8967 | else | |
8968 | { | |
8969 | if (sockunion_same (&peer->su, su)) | |
8970 | { | |
8971 | find = 1; | |
8972 | bgp_show_peer (vty, peer); | |
8973 | } | |
8974 | } | |
718e3744 | 8975 | break; |
8976 | } | |
8977 | } | |
8978 | ||
8979 | if (type == show_peer && ! find) | |
8980 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
8981 | ||
8982 | return CMD_SUCCESS; | |
8983 | } | |
8984 | ||
94f2b392 | 8985 | static int |
fd79ac91 | 8986 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
8987 | enum show_type type, const char *ip_str) | |
718e3744 | 8988 | { |
8989 | int ret; | |
8990 | struct bgp *bgp; | |
8991 | union sockunion su; | |
8992 | ||
718e3744 | 8993 | if (name) |
8994 | { | |
8995 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 8996 | if (! bgp) |
8997 | { | |
8998 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
8999 | return CMD_WARNING; | |
9000 | } | |
718e3744 | 9001 | } |
a80beece DS |
9002 | else |
9003 | { | |
9004 | bgp = bgp_get_default (); | |
9005 | } | |
718e3744 | 9006 | |
9007 | if (bgp) | |
a80beece DS |
9008 | { |
9009 | if (ip_str) | |
9010 | { | |
9011 | ret = str2sockunion (ip_str, &su); | |
9012 | if (ret < 0) | |
9013 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str); | |
9014 | else | |
9015 | bgp_show_neighbor (vty, bgp, type, &su, NULL); | |
9016 | } | |
9017 | else | |
9018 | { | |
9019 | bgp_show_neighbor (vty, bgp, type, NULL, NULL); | |
9020 | } | |
9021 | } | |
718e3744 | 9022 | |
9023 | return CMD_SUCCESS; | |
9024 | } | |
9025 | ||
9026 | /* "show ip bgp neighbors" commands. */ | |
9027 | DEFUN (show_ip_bgp_neighbors, | |
9028 | show_ip_bgp_neighbors_cmd, | |
9029 | "show ip bgp neighbors", | |
9030 | SHOW_STR | |
9031 | IP_STR | |
9032 | BGP_STR | |
9033 | "Detailed information on TCP and BGP neighbor connections\n") | |
9034 | { | |
9035 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); | |
9036 | } | |
9037 | ||
9038 | ALIAS (show_ip_bgp_neighbors, | |
9039 | show_ip_bgp_ipv4_neighbors_cmd, | |
9040 | "show ip bgp ipv4 (unicast|multicast) neighbors", | |
9041 | SHOW_STR | |
9042 | IP_STR | |
9043 | BGP_STR | |
9044 | "Address family\n" | |
9045 | "Address Family modifier\n" | |
9046 | "Address Family modifier\n" | |
9047 | "Detailed information on TCP and BGP neighbor connections\n") | |
9048 | ||
9049 | ALIAS (show_ip_bgp_neighbors, | |
9050 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
9051 | "show ip bgp vpnv4 all neighbors", | |
9052 | SHOW_STR | |
9053 | IP_STR | |
9054 | BGP_STR | |
9055 | "Display VPNv4 NLRI specific information\n" | |
9056 | "Display information about all VPNv4 NLRIs\n" | |
9057 | "Detailed information on TCP and BGP neighbor connections\n") | |
9058 | ||
9059 | ALIAS (show_ip_bgp_neighbors, | |
9060 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
9061 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", | |
9062 | SHOW_STR | |
9063 | IP_STR | |
9064 | BGP_STR | |
9065 | "Display VPNv4 NLRI specific information\n" | |
9066 | "Display information for a route distinguisher\n" | |
9067 | "VPN Route Distinguisher\n" | |
9068 | "Detailed information on TCP and BGP neighbor connections\n") | |
9069 | ||
9070 | ALIAS (show_ip_bgp_neighbors, | |
9071 | show_bgp_neighbors_cmd, | |
9072 | "show bgp neighbors", | |
9073 | SHOW_STR | |
9074 | BGP_STR | |
9075 | "Detailed information on TCP and BGP neighbor connections\n") | |
9076 | ||
9077 | ALIAS (show_ip_bgp_neighbors, | |
9078 | show_bgp_ipv6_neighbors_cmd, | |
9079 | "show bgp ipv6 neighbors", | |
9080 | SHOW_STR | |
9081 | BGP_STR | |
9082 | "Address family\n" | |
9083 | "Detailed information on TCP and BGP neighbor connections\n") | |
9084 | ||
9085 | DEFUN (show_ip_bgp_neighbors_peer, | |
9086 | show_ip_bgp_neighbors_peer_cmd, | |
a80beece | 9087 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9088 | SHOW_STR |
9089 | IP_STR | |
9090 | BGP_STR | |
9091 | "Detailed information on TCP and BGP neighbor connections\n" | |
9092 | "Neighbor to display information about\n" | |
a80beece DS |
9093 | "Neighbor to display information about\n" |
9094 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9095 | { |
9096 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); | |
9097 | } | |
9098 | ||
9099 | ALIAS (show_ip_bgp_neighbors_peer, | |
9100 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
a80beece | 9101 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9102 | SHOW_STR |
9103 | IP_STR | |
9104 | BGP_STR | |
9105 | "Address family\n" | |
9106 | "Address Family modifier\n" | |
9107 | "Address Family modifier\n" | |
9108 | "Detailed information on TCP and BGP neighbor connections\n" | |
9109 | "Neighbor to display information about\n" | |
a80beece DS |
9110 | "Neighbor to display information about\n" |
9111 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9112 | |
9113 | ALIAS (show_ip_bgp_neighbors_peer, | |
9114 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
9115 | "show ip bgp vpnv4 all neighbors A.B.C.D", | |
9116 | SHOW_STR | |
9117 | IP_STR | |
9118 | BGP_STR | |
9119 | "Display VPNv4 NLRI specific information\n" | |
9120 | "Display information about all VPNv4 NLRIs\n" | |
9121 | "Detailed information on TCP and BGP neighbor connections\n" | |
9122 | "Neighbor to display information about\n") | |
9123 | ||
9124 | ALIAS (show_ip_bgp_neighbors_peer, | |
9125 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
9126 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", | |
9127 | SHOW_STR | |
9128 | IP_STR | |
9129 | BGP_STR | |
9130 | "Display VPNv4 NLRI specific information\n" | |
9131 | "Display information about all VPNv4 NLRIs\n" | |
9132 | "Detailed information on TCP and BGP neighbor connections\n" | |
9133 | "Neighbor to display information about\n") | |
9134 | ||
9135 | ALIAS (show_ip_bgp_neighbors_peer, | |
9136 | show_bgp_neighbors_peer_cmd, | |
a80beece | 9137 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9138 | SHOW_STR |
9139 | BGP_STR | |
9140 | "Detailed information on TCP and BGP neighbor connections\n" | |
9141 | "Neighbor to display information about\n" | |
a80beece DS |
9142 | "Neighbor to display information about\n" |
9143 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9144 | |
9145 | ALIAS (show_ip_bgp_neighbors_peer, | |
9146 | show_bgp_ipv6_neighbors_peer_cmd, | |
a80beece | 9147 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9148 | SHOW_STR |
9149 | BGP_STR | |
9150 | "Address family\n" | |
9151 | "Detailed information on TCP and BGP neighbor connections\n" | |
9152 | "Neighbor to display information about\n" | |
a80beece DS |
9153 | "Neighbor to display information about\n" |
9154 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9155 | |
9156 | DEFUN (show_ip_bgp_instance_neighbors, | |
9157 | show_ip_bgp_instance_neighbors_cmd, | |
9158 | "show ip bgp view WORD neighbors", | |
9159 | SHOW_STR | |
9160 | IP_STR | |
9161 | BGP_STR | |
9162 | "BGP view\n" | |
9163 | "View name\n" | |
9164 | "Detailed information on TCP and BGP neighbor connections\n") | |
9165 | { | |
9166 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); | |
9167 | } | |
9168 | ||
bb46e94f | 9169 | ALIAS (show_ip_bgp_instance_neighbors, |
9170 | show_bgp_instance_neighbors_cmd, | |
9171 | "show bgp view WORD neighbors", | |
9172 | SHOW_STR | |
9173 | BGP_STR | |
9174 | "BGP view\n" | |
9175 | "View name\n" | |
9176 | "Detailed information on TCP and BGP neighbor connections\n") | |
9177 | ||
9178 | ALIAS (show_ip_bgp_instance_neighbors, | |
9179 | show_bgp_instance_ipv6_neighbors_cmd, | |
9180 | "show bgp view WORD ipv6 neighbors", | |
9181 | SHOW_STR | |
9182 | BGP_STR | |
9183 | "BGP view\n" | |
9184 | "View name\n" | |
9185 | "Address family\n" | |
9186 | "Detailed information on TCP and BGP neighbor connections\n") | |
9187 | ||
718e3744 | 9188 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
9189 | show_ip_bgp_instance_neighbors_peer_cmd, | |
a80beece | 9190 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9191 | SHOW_STR |
9192 | IP_STR | |
9193 | BGP_STR | |
9194 | "BGP view\n" | |
9195 | "View name\n" | |
9196 | "Detailed information on TCP and BGP neighbor connections\n" | |
9197 | "Neighbor to display information about\n" | |
a80beece DS |
9198 | "Neighbor to display information about\n" |
9199 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9200 | { |
9201 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); | |
9202 | } | |
bb46e94f | 9203 | |
9204 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
9205 | show_bgp_instance_neighbors_peer_cmd, | |
a80beece | 9206 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 9207 | SHOW_STR |
9208 | BGP_STR | |
9209 | "BGP view\n" | |
9210 | "View name\n" | |
9211 | "Detailed information on TCP and BGP neighbor connections\n" | |
9212 | "Neighbor to display information about\n" | |
a80beece DS |
9213 | "Neighbor to display information about\n" |
9214 | "Neighbor on bgp configured interface\n") | |
bb46e94f | 9215 | |
9216 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
9217 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
a80beece | 9218 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 9219 | SHOW_STR |
9220 | BGP_STR | |
9221 | "BGP view\n" | |
9222 | "View name\n" | |
9223 | "Address family\n" | |
9224 | "Detailed information on TCP and BGP neighbor connections\n" | |
9225 | "Neighbor to display information about\n" | |
a80beece DS |
9226 | "Neighbor to display information about\n" |
9227 | "Neighbor on bgp configured interface\n") | |
6b0655a2 | 9228 | |
718e3744 | 9229 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
9230 | paths' and `show ip mbgp paths'. Those functions results are the | |
9231 | same.*/ | |
9232 | DEFUN (show_ip_bgp_paths, | |
9233 | show_ip_bgp_paths_cmd, | |
9234 | "show ip bgp paths", | |
9235 | SHOW_STR | |
9236 | IP_STR | |
9237 | BGP_STR | |
9238 | "Path information\n") | |
9239 | { | |
9240 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
9241 | aspath_print_all_vty (vty); | |
9242 | return CMD_SUCCESS; | |
9243 | } | |
9244 | ||
9245 | DEFUN (show_ip_bgp_ipv4_paths, | |
9246 | show_ip_bgp_ipv4_paths_cmd, | |
9247 | "show ip bgp ipv4 (unicast|multicast) paths", | |
9248 | SHOW_STR | |
9249 | IP_STR | |
9250 | BGP_STR | |
9251 | "Address family\n" | |
9252 | "Address Family modifier\n" | |
9253 | "Address Family modifier\n" | |
9254 | "Path information\n") | |
9255 | { | |
9256 | vty_out (vty, "Address Refcnt Path\r\n"); | |
9257 | aspath_print_all_vty (vty); | |
9258 | ||
9259 | return CMD_SUCCESS; | |
9260 | } | |
6b0655a2 | 9261 | |
718e3744 | 9262 | #include "hash.h" |
9263 | ||
94f2b392 | 9264 | static void |
718e3744 | 9265 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
9266 | { | |
9267 | struct community *com; | |
9268 | ||
9269 | com = (struct community *) backet->data; | |
9270 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
9271 | community_str (com), VTY_NEWLINE); | |
9272 | } | |
9273 | ||
9274 | /* Show BGP's community internal data. */ | |
9275 | DEFUN (show_ip_bgp_community_info, | |
9276 | show_ip_bgp_community_info_cmd, | |
9277 | "show ip bgp community-info", | |
9278 | SHOW_STR | |
9279 | IP_STR | |
9280 | BGP_STR | |
9281 | "List all bgp community information\n") | |
9282 | { | |
9283 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
9284 | ||
9285 | hash_iterate (community_hash (), | |
9286 | (void (*) (struct hash_backet *, void *)) | |
9287 | community_show_all_iterator, | |
9288 | vty); | |
9289 | ||
9290 | return CMD_SUCCESS; | |
9291 | } | |
9292 | ||
9293 | DEFUN (show_ip_bgp_attr_info, | |
9294 | show_ip_bgp_attr_info_cmd, | |
9295 | "show ip bgp attribute-info", | |
9296 | SHOW_STR | |
9297 | IP_STR | |
9298 | BGP_STR | |
9299 | "List all bgp attribute information\n") | |
9300 | { | |
9301 | attr_show_all (vty); | |
9302 | return CMD_SUCCESS; | |
9303 | } | |
6b0655a2 | 9304 | |
94f2b392 | 9305 | static int |
fee0f4c6 | 9306 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
9307 | afi_t afi, safi_t safi) | |
9308 | { | |
9309 | char timebuf[BGP_UPTIME_LEN]; | |
9310 | char rmbuf[14]; | |
fd79ac91 | 9311 | const char *rmname; |
fee0f4c6 | 9312 | struct peer *peer; |
1eb8ef25 | 9313 | struct listnode *node, *nnode; |
fee0f4c6 | 9314 | int len; |
9315 | int count = 0; | |
9316 | ||
9317 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
9318 | { | |
1eb8ef25 | 9319 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 9320 | { |
9321 | count++; | |
9322 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
9323 | } | |
9324 | return count; | |
9325 | } | |
9326 | ||
9327 | len = vty_out (vty, "%s", rsclient->host); | |
9328 | len = 16 - len; | |
9329 | ||
9330 | if (len < 1) | |
9331 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
9332 | else | |
9333 | vty_out (vty, "%*s", len, " "); | |
9334 | ||
3d515fd9 | 9335 | vty_out (vty, "4 "); |
fee0f4c6 | 9336 | |
0b2aa3a0 | 9337 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 9338 | |
9339 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
9340 | if ( rmname && strlen (rmname) > 13 ) | |
9341 | { | |
9342 | sprintf (rmbuf, "%13s", "..."); | |
9343 | rmname = strncpy (rmbuf, rmname, 10); | |
9344 | } | |
9345 | else if (! rmname) | |
9346 | rmname = "<none>"; | |
9347 | vty_out (vty, " %13s ", rmname); | |
9348 | ||
9349 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
9350 | if ( rmname && strlen (rmname) > 13 ) | |
9351 | { | |
9352 | sprintf (rmbuf, "%13s", "..."); | |
9353 | rmname = strncpy (rmbuf, rmname, 10); | |
9354 | } | |
9355 | else if (! rmname) | |
9356 | rmname = "<none>"; | |
9357 | vty_out (vty, " %13s ", rmname); | |
9358 | ||
9359 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); | |
9360 | ||
9361 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
9362 | vty_out (vty, " Idle (Admin)"); | |
9363 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
9364 | vty_out (vty, " Idle (PfxCt)"); | |
9365 | else | |
9366 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
9367 | ||
9368 | vty_out (vty, "%s", VTY_NEWLINE); | |
9369 | ||
9370 | return 1; | |
9371 | } | |
9372 | ||
94f2b392 | 9373 | static int |
fd79ac91 | 9374 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
9375 | afi_t afi, safi_t safi) | |
fee0f4c6 | 9376 | { |
9377 | struct peer *peer; | |
1eb8ef25 | 9378 | struct listnode *node, *nnode; |
fee0f4c6 | 9379 | int count = 0; |
9380 | ||
9381 | /* Header string for each address family. */ | |
9382 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
9383 | ||
1eb8ef25 | 9384 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 9385 | { |
9386 | if (peer->afc[afi][safi] && | |
9387 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
9388 | { | |
9389 | if (! count) | |
9390 | { | |
9391 | vty_out (vty, | |
9392 | "Route Server's BGP router identifier %s%s", | |
9393 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
9394 | vty_out (vty, | |
aea339f7 | 9395 | "Route Server's local AS number %u%s", bgp->as, |
fee0f4c6 | 9396 | VTY_NEWLINE); |
9397 | ||
9398 | vty_out (vty, "%s", VTY_NEWLINE); | |
9399 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
9400 | } | |
9401 | ||
9402 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
9403 | } | |
9404 | } | |
9405 | ||
9406 | if (count) | |
9407 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
9408 | count, VTY_NEWLINE); | |
9409 | else | |
9410 | vty_out (vty, "No %s Route Server Client is configured%s", | |
9411 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
9412 | ||
9413 | return CMD_SUCCESS; | |
9414 | } | |
9415 | ||
94f2b392 | 9416 | static int |
fd79ac91 | 9417 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
9418 | afi_t afi, safi_t safi) | |
fee0f4c6 | 9419 | { |
9420 | struct bgp *bgp; | |
9421 | ||
9422 | if (name) | |
9423 | { | |
9424 | bgp = bgp_lookup_by_name (name); | |
9425 | ||
9426 | if (! bgp) | |
9427 | { | |
9428 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
9429 | return CMD_WARNING; | |
9430 | } | |
9431 | ||
9432 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
9433 | return CMD_SUCCESS; | |
9434 | } | |
9435 | ||
9436 | bgp = bgp_get_default (); | |
9437 | ||
9438 | if (bgp) | |
9439 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
9440 | ||
9441 | return CMD_SUCCESS; | |
9442 | } | |
9443 | ||
9444 | /* 'show bgp rsclient' commands. */ | |
9445 | DEFUN (show_ip_bgp_rsclient_summary, | |
9446 | show_ip_bgp_rsclient_summary_cmd, | |
9447 | "show ip bgp rsclient summary", | |
9448 | SHOW_STR | |
9449 | IP_STR | |
9450 | BGP_STR | |
9451 | "Information about Route Server Clients\n" | |
9452 | "Summary of all Route Server Clients\n") | |
9453 | { | |
9454 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
9455 | } | |
9456 | ||
9457 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
9458 | show_ip_bgp_instance_rsclient_summary_cmd, | |
9459 | "show ip bgp view WORD rsclient summary", | |
9460 | SHOW_STR | |
9461 | IP_STR | |
9462 | BGP_STR | |
9463 | "BGP view\n" | |
9464 | "View name\n" | |
9465 | "Information about Route Server Clients\n" | |
9466 | "Summary of all Route Server Clients\n") | |
9467 | { | |
9468 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
9469 | } | |
9470 | ||
9471 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
9472 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
9473 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
9474 | SHOW_STR | |
9475 | IP_STR | |
9476 | BGP_STR | |
9477 | "Address family\n" | |
9478 | "Address Family modifier\n" | |
9479 | "Address Family modifier\n" | |
9480 | "Information about Route Server Clients\n" | |
9481 | "Summary of all Route Server Clients\n") | |
9482 | { | |
9483 | if (strncmp (argv[0], "m", 1) == 0) | |
9484 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
9485 | ||
9486 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
9487 | } | |
9488 | ||
9489 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
9490 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
9491 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
9492 | SHOW_STR | |
9493 | IP_STR | |
9494 | BGP_STR | |
9495 | "BGP view\n" | |
9496 | "View name\n" | |
9497 | "Address family\n" | |
9498 | "Address Family modifier\n" | |
9499 | "Address Family modifier\n" | |
9500 | "Information about Route Server Clients\n" | |
9501 | "Summary of all Route Server Clients\n") | |
9502 | { | |
9503 | if (strncmp (argv[1], "m", 1) == 0) | |
9504 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
9505 | ||
9506 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
9507 | } | |
9508 | ||
95cbbd2a ML |
9509 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
9510 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, | |
9511 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
9512 | SHOW_STR | |
9513 | BGP_STR | |
9514 | "BGP view\n" | |
9515 | "View name\n" | |
9516 | "Address family\n" | |
9517 | "Address Family modifier\n" | |
9518 | "Address Family modifier\n" | |
9519 | "Information about Route Server Clients\n" | |
9520 | "Summary of all Route Server Clients\n") | |
9521 | { | |
9522 | safi_t safi; | |
9523 | ||
9524 | if (argc == 2) { | |
9525 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
9526 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); | |
9527 | } else { | |
9528 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
9529 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); | |
9530 | } | |
9531 | } | |
9532 | ||
9533 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, | |
9534 | show_bgp_ipv4_safi_rsclient_summary_cmd, | |
9535 | "show bgp ipv4 (unicast|multicast) rsclient summary", | |
9536 | SHOW_STR | |
9537 | BGP_STR | |
9538 | "Address family\n" | |
9539 | "Address Family modifier\n" | |
9540 | "Address Family modifier\n" | |
9541 | "Information about Route Server Clients\n" | |
9542 | "Summary of all Route Server Clients\n") | |
9543 | ||
fee0f4c6 | 9544 | #ifdef HAVE_IPV6 |
9545 | DEFUN (show_bgp_rsclient_summary, | |
9546 | show_bgp_rsclient_summary_cmd, | |
9547 | "show bgp rsclient summary", | |
9548 | SHOW_STR | |
9549 | BGP_STR | |
9550 | "Information about Route Server Clients\n" | |
9551 | "Summary of all Route Server Clients\n") | |
9552 | { | |
9553 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
9554 | } | |
9555 | ||
9556 | DEFUN (show_bgp_instance_rsclient_summary, | |
9557 | show_bgp_instance_rsclient_summary_cmd, | |
9558 | "show bgp view WORD rsclient summary", | |
9559 | SHOW_STR | |
9560 | BGP_STR | |
9561 | "BGP view\n" | |
9562 | "View name\n" | |
9563 | "Information about Route Server Clients\n" | |
9564 | "Summary of all Route Server Clients\n") | |
9565 | { | |
9566 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
9567 | } | |
9568 | ||
9569 | ALIAS (show_bgp_rsclient_summary, | |
9570 | show_bgp_ipv6_rsclient_summary_cmd, | |
9571 | "show bgp ipv6 rsclient summary", | |
9572 | SHOW_STR | |
9573 | BGP_STR | |
9574 | "Address family\n" | |
9575 | "Information about Route Server Clients\n" | |
9576 | "Summary of all Route Server Clients\n") | |
9577 | ||
9578 | ALIAS (show_bgp_instance_rsclient_summary, | |
9579 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
9580 | "show bgp view WORD ipv6 rsclient summary", | |
9581 | SHOW_STR | |
9582 | BGP_STR | |
9583 | "BGP view\n" | |
9584 | "View name\n" | |
9585 | "Address family\n" | |
9586 | "Information about Route Server Clients\n" | |
9587 | "Summary of all Route Server Clients\n") | |
95cbbd2a ML |
9588 | |
9589 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, | |
9590 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, | |
9591 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", | |
9592 | SHOW_STR | |
9593 | BGP_STR | |
9594 | "BGP view\n" | |
9595 | "View name\n" | |
9596 | "Address family\n" | |
9597 | "Address Family modifier\n" | |
9598 | "Address Family modifier\n" | |
9599 | "Information about Route Server Clients\n" | |
9600 | "Summary of all Route Server Clients\n") | |
9601 | { | |
9602 | safi_t safi; | |
9603 | ||
9604 | if (argc == 2) { | |
9605 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
9606 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); | |
9607 | } else { | |
9608 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
9609 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); | |
9610 | } | |
9611 | } | |
9612 | ||
9613 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, | |
9614 | show_bgp_ipv6_safi_rsclient_summary_cmd, | |
9615 | "show bgp ipv6 (unicast|multicast) rsclient summary", | |
9616 | SHOW_STR | |
9617 | BGP_STR | |
9618 | "Address family\n" | |
9619 | "Address Family modifier\n" | |
9620 | "Address Family modifier\n" | |
9621 | "Information about Route Server Clients\n" | |
9622 | "Summary of all Route Server Clients\n") | |
9623 | ||
fee0f4c6 | 9624 | #endif /* HAVE IPV6 */ |
6b0655a2 | 9625 | |
718e3744 | 9626 | /* Redistribute VTY commands. */ |
9627 | ||
718e3744 | 9628 | DEFUN (bgp_redistribute_ipv4, |
9629 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 9630 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 9631 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9632 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 9633 | { |
9634 | int type; | |
9635 | ||
e0ca5fde DL |
9636 | type = proto_redistnum (AFI_IP, argv[0]); |
9637 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9638 | { |
9639 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9640 | return CMD_WARNING; | |
9641 | } | |
9642 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9643 | } | |
9644 | ||
9645 | DEFUN (bgp_redistribute_ipv4_rmap, | |
9646 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 9647 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9648 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9649 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9650 | "Route map reference\n" |
9651 | "Pointer to route-map entries\n") | |
9652 | { | |
9653 | int type; | |
9654 | ||
e0ca5fde DL |
9655 | type = proto_redistnum (AFI_IP, argv[0]); |
9656 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9657 | { |
9658 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9659 | return CMD_WARNING; | |
9660 | } | |
9661 | ||
9662 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
9663 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9664 | } | |
9665 | ||
9666 | DEFUN (bgp_redistribute_ipv4_metric, | |
9667 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 9668 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9669 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9670 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9671 | "Metric for redistributed routes\n" |
9672 | "Default metric\n") | |
9673 | { | |
9674 | int type; | |
9675 | u_int32_t metric; | |
9676 | ||
e0ca5fde DL |
9677 | type = proto_redistnum (AFI_IP, argv[0]); |
9678 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9679 | { |
9680 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9681 | return CMD_WARNING; | |
9682 | } | |
9683 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9684 | ||
9685 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
9686 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9687 | } | |
9688 | ||
9689 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
9690 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 9691 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9692 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9693 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9694 | "Route map reference\n" |
9695 | "Pointer to route-map entries\n" | |
9696 | "Metric for redistributed routes\n" | |
9697 | "Default metric\n") | |
9698 | { | |
9699 | int type; | |
9700 | u_int32_t metric; | |
9701 | ||
e0ca5fde DL |
9702 | type = proto_redistnum (AFI_IP, argv[0]); |
9703 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9704 | { |
9705 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9706 | return CMD_WARNING; | |
9707 | } | |
9708 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
9709 | ||
9710 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
9711 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
9712 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9713 | } | |
9714 | ||
9715 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
9716 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 9717 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9718 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9719 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9720 | "Metric for redistributed routes\n" |
9721 | "Default metric\n" | |
9722 | "Route map reference\n" | |
9723 | "Pointer to route-map entries\n") | |
9724 | { | |
9725 | int type; | |
9726 | u_int32_t metric; | |
9727 | ||
e0ca5fde DL |
9728 | type = proto_redistnum (AFI_IP, argv[0]); |
9729 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9730 | { |
9731 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9732 | return CMD_WARNING; | |
9733 | } | |
9734 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9735 | ||
9736 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
9737 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); | |
9738 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9739 | } | |
9740 | ||
9741 | DEFUN (no_bgp_redistribute_ipv4, | |
9742 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 9743 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 9744 | NO_STR |
9745 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9746 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 9747 | { |
9748 | int type; | |
9749 | ||
e0ca5fde DL |
9750 | type = proto_redistnum (AFI_IP, argv[0]); |
9751 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9752 | { |
9753 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9754 | return CMD_WARNING; | |
9755 | } | |
9756 | ||
9757 | return bgp_redistribute_unset (vty->index, AFI_IP, type); | |
9758 | } | |
9759 | ||
503006bc | 9760 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 9761 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 9762 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9763 | NO_STR |
9764 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9765 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9766 | "Route map reference\n" |
9767 | "Pointer to route-map entries\n") | |
718e3744 | 9768 | |
503006bc | 9769 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 9770 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 9771 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9772 | NO_STR |
9773 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9774 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9775 | "Metric for redistributed routes\n" |
9776 | "Default metric\n") | |
718e3744 | 9777 | |
503006bc | 9778 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 9779 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 9780 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9781 | NO_STR |
9782 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9783 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9784 | "Route map reference\n" |
9785 | "Pointer to route-map entries\n" | |
9786 | "Metric for redistributed routes\n" | |
9787 | "Default metric\n") | |
718e3744 | 9788 | |
503006bc | 9789 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 9790 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 9791 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9792 | NO_STR |
9793 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9794 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9795 | "Metric for redistributed routes\n" |
9796 | "Default metric\n" | |
9797 | "Route map reference\n" | |
9798 | "Pointer to route-map entries\n") | |
6b0655a2 | 9799 | |
718e3744 | 9800 | #ifdef HAVE_IPV6 |
9801 | DEFUN (bgp_redistribute_ipv6, | |
9802 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 9803 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 9804 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9805 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 9806 | { |
9807 | int type; | |
9808 | ||
e0ca5fde DL |
9809 | type = proto_redistnum (AFI_IP6, argv[0]); |
9810 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9811 | { |
9812 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9813 | return CMD_WARNING; | |
9814 | } | |
9815 | ||
9816 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9817 | } | |
9818 | ||
9819 | DEFUN (bgp_redistribute_ipv6_rmap, | |
9820 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 9821 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9822 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9823 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9824 | "Route map reference\n" |
9825 | "Pointer to route-map entries\n") | |
9826 | { | |
9827 | int type; | |
9828 | ||
e0ca5fde DL |
9829 | type = proto_redistnum (AFI_IP6, argv[0]); |
9830 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9831 | { |
9832 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9833 | return CMD_WARNING; | |
9834 | } | |
9835 | ||
9836 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
9837 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9838 | } | |
9839 | ||
9840 | DEFUN (bgp_redistribute_ipv6_metric, | |
9841 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 9842 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9843 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9844 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9845 | "Metric for redistributed routes\n" |
9846 | "Default metric\n") | |
9847 | { | |
9848 | int type; | |
9849 | u_int32_t metric; | |
9850 | ||
e0ca5fde DL |
9851 | type = proto_redistnum (AFI_IP6, argv[0]); |
9852 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9853 | { |
9854 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9855 | return CMD_WARNING; | |
9856 | } | |
9857 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9858 | ||
9859 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9860 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9861 | } | |
9862 | ||
9863 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
9864 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 9865 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9866 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9867 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9868 | "Route map reference\n" |
9869 | "Pointer to route-map entries\n" | |
9870 | "Metric for redistributed routes\n" | |
9871 | "Default metric\n") | |
9872 | { | |
9873 | int type; | |
9874 | u_int32_t metric; | |
9875 | ||
e0ca5fde DL |
9876 | type = proto_redistnum (AFI_IP6, argv[0]); |
9877 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9878 | { |
9879 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9880 | return CMD_WARNING; | |
9881 | } | |
9882 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
9883 | ||
9884 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
9885 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9886 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9887 | } | |
9888 | ||
9889 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
9890 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 9891 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9892 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9893 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9894 | "Metric for redistributed routes\n" |
9895 | "Default metric\n" | |
9896 | "Route map reference\n" | |
9897 | "Pointer to route-map entries\n") | |
9898 | { | |
9899 | int type; | |
9900 | u_int32_t metric; | |
9901 | ||
e0ca5fde DL |
9902 | type = proto_redistnum (AFI_IP6, argv[0]); |
9903 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9904 | { |
9905 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9906 | return CMD_WARNING; | |
9907 | } | |
9908 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9909 | ||
9910 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9911 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); | |
9912 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9913 | } | |
9914 | ||
9915 | DEFUN (no_bgp_redistribute_ipv6, | |
9916 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 9917 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 9918 | NO_STR |
9919 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9920 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 9921 | { |
9922 | int type; | |
9923 | ||
e0ca5fde DL |
9924 | type = proto_redistnum (AFI_IP6, argv[0]); |
9925 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9926 | { |
9927 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9928 | return CMD_WARNING; | |
9929 | } | |
9930 | ||
9931 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); | |
9932 | } | |
9933 | ||
503006bc | 9934 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 9935 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 9936 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9937 | NO_STR |
9938 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9939 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9940 | "Route map reference\n" |
9941 | "Pointer to route-map entries\n") | |
718e3744 | 9942 | |
503006bc | 9943 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 9944 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 9945 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9946 | NO_STR |
9947 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9948 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9949 | "Metric for redistributed routes\n" |
9950 | "Default metric\n") | |
718e3744 | 9951 | |
503006bc | 9952 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 9953 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 9954 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9955 | NO_STR |
9956 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9957 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9958 | "Route map reference\n" |
9959 | "Pointer to route-map entries\n" | |
9960 | "Metric for redistributed routes\n" | |
9961 | "Default metric\n") | |
718e3744 | 9962 | |
503006bc | 9963 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 9964 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 9965 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9966 | NO_STR |
9967 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9968 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9969 | "Metric for redistributed routes\n" |
9970 | "Default metric\n" | |
9971 | "Route map reference\n" | |
9972 | "Pointer to route-map entries\n") | |
9973 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 9974 | |
718e3744 | 9975 | int |
9976 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
9977 | safi_t safi, int *write) | |
9978 | { | |
9979 | int i; | |
718e3744 | 9980 | |
9981 | /* Unicast redistribution only. */ | |
9982 | if (safi != SAFI_UNICAST) | |
9983 | return 0; | |
9984 | ||
9985 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
9986 | { | |
9987 | /* Redistribute BGP does not make sense. */ | |
9988 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) | |
9989 | { | |
9990 | /* Display "address-family" when it is not yet diplayed. */ | |
9991 | bgp_config_write_family_header (vty, afi, safi, write); | |
9992 | ||
9993 | /* "redistribute" configuration. */ | |
f52d13cb | 9994 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
718e3744 | 9995 | |
9996 | if (bgp->redist_metric_flag[afi][i]) | |
ddc943de | 9997 | vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); |
718e3744 | 9998 | |
9999 | if (bgp->rmap[afi][i].name) | |
10000 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); | |
10001 | ||
10002 | vty_out (vty, "%s", VTY_NEWLINE); | |
10003 | } | |
10004 | } | |
10005 | return *write; | |
10006 | } | |
6b0655a2 | 10007 | |
718e3744 | 10008 | /* BGP node structure. */ |
7fc626de | 10009 | static struct cmd_node bgp_node = |
718e3744 | 10010 | { |
10011 | BGP_NODE, | |
10012 | "%s(config-router)# ", | |
10013 | 1, | |
10014 | }; | |
10015 | ||
7fc626de | 10016 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 10017 | { |
10018 | BGP_IPV4_NODE, | |
10019 | "%s(config-router-af)# ", | |
10020 | 1, | |
10021 | }; | |
10022 | ||
7fc626de | 10023 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 10024 | { |
10025 | BGP_IPV4M_NODE, | |
10026 | "%s(config-router-af)# ", | |
10027 | 1, | |
10028 | }; | |
10029 | ||
7fc626de | 10030 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 10031 | { |
10032 | BGP_IPV6_NODE, | |
10033 | "%s(config-router-af)# ", | |
10034 | 1, | |
10035 | }; | |
10036 | ||
7fc626de | 10037 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 10038 | { |
10039 | BGP_IPV6M_NODE, | |
10040 | "%s(config-router-af)# ", | |
10041 | 1, | |
10042 | }; | |
10043 | ||
7fc626de | 10044 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 10045 | { |
10046 | BGP_VPNV4_NODE, | |
10047 | "%s(config-router-af)# ", | |
10048 | 1 | |
10049 | }; | |
6b0655a2 | 10050 | |
1f8ae70b | 10051 | static void community_list_vty (void); |
10052 | ||
718e3744 | 10053 | void |
94f2b392 | 10054 | bgp_vty_init (void) |
718e3744 | 10055 | { |
718e3744 | 10056 | /* Install bgp top node. */ |
10057 | install_node (&bgp_node, bgp_config_write); | |
10058 | install_node (&bgp_ipv4_unicast_node, NULL); | |
10059 | install_node (&bgp_ipv4_multicast_node, NULL); | |
10060 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 10061 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 10062 | install_node (&bgp_vpnv4_node, NULL); |
10063 | ||
10064 | /* Install default VTY commands to new nodes. */ | |
10065 | install_default (BGP_NODE); | |
10066 | install_default (BGP_IPV4_NODE); | |
10067 | install_default (BGP_IPV4M_NODE); | |
10068 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 10069 | install_default (BGP_IPV6M_NODE); |
718e3744 | 10070 | install_default (BGP_VPNV4_NODE); |
10071 | ||
10072 | /* "bgp multiple-instance" commands. */ | |
10073 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
10074 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
10075 | ||
10076 | /* "bgp config-type" commands. */ | |
10077 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
10078 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
10079 | ||
10080 | /* Dummy commands (Currently not supported) */ | |
10081 | install_element (BGP_NODE, &no_synchronization_cmd); | |
10082 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
10083 | ||
10084 | /* "router bgp" commands. */ | |
10085 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
10086 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
10087 | ||
10088 | /* "no router bgp" commands. */ | |
10089 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
10090 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
10091 | ||
10092 | /* "bgp router-id" commands. */ | |
10093 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
10094 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
10095 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
10096 | ||
10097 | /* "bgp cluster-id" commands. */ | |
10098 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
10099 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
10100 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
10101 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
10102 | ||
10103 | /* "bgp confederation" commands. */ | |
10104 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
10105 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
10106 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
10107 | ||
10108 | /* "bgp confederation peers" commands. */ | |
10109 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
10110 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
10111 | ||
abc920f8 DS |
10112 | /* bgp max-med command */ |
10113 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
10114 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
10115 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
10116 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
10117 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
10118 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
10119 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
10120 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
10121 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
10122 | ||
f188f2c4 DS |
10123 | /* bgp update-delay command */ |
10124 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
10125 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
10126 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
10127 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
10128 | ||
cb1faec9 DS |
10129 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
10130 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
10131 | ||
165b5fff JB |
10132 | /* "maximum-paths" commands. */ |
10133 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
10134 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
10135 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
10136 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
10137 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
10138 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
10139 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
10140 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
10141 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 10142 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 10143 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
10144 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
10145 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 10146 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 10147 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 10148 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 10149 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 10150 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 10151 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 10152 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 10153 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
10154 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
10155 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 10156 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 10157 | |
718e3744 | 10158 | /* "timers bgp" commands. */ |
10159 | install_element (BGP_NODE, &bgp_timers_cmd); | |
10160 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
10161 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
10162 | ||
518f0eb1 DS |
10163 | /* route-map delay-timer commands */ |
10164 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); | |
10165 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
10166 | ||
718e3744 | 10167 | /* "bgp client-to-client reflection" commands */ |
10168 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
10169 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
10170 | ||
10171 | /* "bgp always-compare-med" commands */ | |
10172 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
10173 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
10174 | ||
10175 | /* "bgp deterministic-med" commands */ | |
10176 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
10177 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 10178 | |
538621f2 | 10179 | /* "bgp graceful-restart" commands */ |
10180 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
10181 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 10182 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
10183 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
10184 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 10185 | |
10186 | /* "bgp fast-external-failover" commands */ | |
10187 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
10188 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
10189 | ||
10190 | /* "bgp enforce-first-as" commands */ | |
10191 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
10192 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
10193 | ||
10194 | /* "bgp bestpath compare-routerid" commands */ | |
10195 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
10196 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
10197 | ||
10198 | /* "bgp bestpath as-path ignore" commands */ | |
10199 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
10200 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
10201 | ||
6811845b | 10202 | /* "bgp bestpath as-path confed" commands */ |
10203 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
10204 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
10205 | ||
2fdd455c PM |
10206 | /* "bgp bestpath as-path multipath-relax" commands */ |
10207 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
10208 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
10209 | ||
848973c7 | 10210 | /* "bgp log-neighbor-changes" commands */ |
10211 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
10212 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
10213 | ||
718e3744 | 10214 | /* "bgp bestpath med" commands */ |
10215 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
10216 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
10217 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
10218 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
10219 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
10220 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
10221 | ||
10222 | /* "no bgp default ipv4-unicast" commands. */ | |
10223 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
10224 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
10225 | ||
10226 | /* "bgp network import-check" commands. */ | |
10227 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
10228 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
10229 | ||
10230 | /* "bgp default local-preference" commands. */ | |
10231 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
10232 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
10233 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
10234 | ||
8bd9d948 DS |
10235 | /* bgp ibgp-allow-policy-mods command */ |
10236 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
10237 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
10238 | ||
718e3744 | 10239 | /* "neighbor remote-as" commands. */ |
10240 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 10241 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
718e3744 | 10242 | install_element (BGP_NODE, &no_neighbor_cmd); |
10243 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 10244 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 10245 | |
10246 | /* "neighbor peer-group" commands. */ | |
10247 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
10248 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 10249 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 10250 | |
10251 | /* "neighbor local-as" commands. */ | |
10252 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
10253 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 10254 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 10255 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
10256 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
10257 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 10258 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 10259 | |
0df7c91f PJ |
10260 | /* "neighbor password" commands. */ |
10261 | install_element (BGP_NODE, &neighbor_password_cmd); | |
10262 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
10263 | ||
718e3744 | 10264 | /* "neighbor activate" commands. */ |
10265 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
10266 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
10267 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
10268 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 10269 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 10270 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
10271 | ||
10272 | /* "no neighbor activate" commands. */ | |
10273 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
10274 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
10275 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
10276 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 10277 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 10278 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
10279 | ||
10280 | /* "neighbor peer-group set" commands. */ | |
10281 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
10282 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
10283 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
10284 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 10285 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 10286 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
10287 | ||
718e3744 | 10288 | /* "no neighbor peer-group unset" commands. */ |
10289 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
10290 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
10291 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
10292 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 10293 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 10294 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
10295 | ||
718e3744 | 10296 | /* "neighbor softreconfiguration inbound" commands.*/ |
10297 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
10298 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
10299 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
10300 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
10301 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
10302 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
10303 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
10304 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 10305 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
10306 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 10307 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
10308 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 10309 | |
10310 | /* "neighbor attribute-unchanged" commands. */ | |
10311 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
10312 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
10313 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
10314 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
10315 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
10316 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
10317 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
10318 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
10319 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
10320 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
10321 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
10322 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
10323 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
10324 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
10325 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
10326 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
10327 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
10328 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
10329 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
10330 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
10331 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
10332 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
10333 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
10334 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
10335 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
10336 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
10337 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
10338 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
10339 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
10340 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
10341 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
10342 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
10343 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
10344 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
10345 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
10346 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
10347 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
10348 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
10349 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
10350 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
10351 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
10352 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
10353 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
10354 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
10355 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
10356 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
10357 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
10358 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
10359 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
10360 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
10361 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
10362 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
10363 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
10364 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
10365 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
10366 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
10367 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
10368 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
10369 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
10370 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
10371 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
10372 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
10373 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
10374 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
10375 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
10376 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
10377 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
10378 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
10379 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
10380 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
10381 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
10382 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
10383 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
10384 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
10385 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
10386 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
10387 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
10388 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
10389 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
10390 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
10391 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
10392 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
10393 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
10394 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
10395 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
10396 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
10397 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
10398 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 10399 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
10400 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
10401 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
10402 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
10403 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
10404 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
10405 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
10406 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
10407 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
10408 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
10409 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
10410 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
10411 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
10412 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
10413 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
10414 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
10415 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
10416 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
10417 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
10418 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
10419 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
10420 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 10421 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
10422 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
10423 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
10424 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
10425 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
10426 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
10427 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
10428 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
10429 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
10430 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
10431 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
10432 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
10433 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
10434 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
10435 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
10436 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
10437 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
10438 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
10439 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
10440 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
10441 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
10442 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
10443 | ||
fee0f4c6 | 10444 | /* "nexthop-local unchanged" commands */ |
10445 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
10446 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
10447 | ||
718e3744 | 10448 | /* "transparent-as" and "transparent-nexthop" for old version |
10449 | compatibility. */ | |
10450 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
10451 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
10452 | ||
10453 | /* "neighbor next-hop-self" commands. */ | |
10454 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
10455 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
10456 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
10457 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
10458 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
10459 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
10460 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
10461 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 10462 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
10463 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 10464 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
10465 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
10466 | ||
c7122e14 DS |
10467 | /* "neighbor as-override" commands. */ |
10468 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
10469 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
10470 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
10471 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
10472 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
10473 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
10474 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
10475 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
10476 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
10477 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
10478 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
10479 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
10480 | ||
718e3744 | 10481 | /* "neighbor remove-private-AS" commands. */ |
10482 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
10483 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
10484 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
10485 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
10486 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
10487 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
10488 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
10489 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 10490 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
10491 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
10492 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
10493 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
10494 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
10495 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
10496 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
10497 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 10498 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
10499 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
10500 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
10501 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
10502 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
10503 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
10504 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
10505 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 10506 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
10507 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
10508 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
10509 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
10510 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
10511 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
10512 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
10513 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 10514 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
10515 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
10516 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
10517 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
10518 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
10519 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
10520 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
10521 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 10522 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
10523 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
10524 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
10525 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
10526 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
10527 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
10528 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
10529 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 10530 | |
10531 | /* "neighbor send-community" commands.*/ | |
10532 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
10533 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
10534 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
10535 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
10536 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
10537 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
10538 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
10539 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
10540 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
10541 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
10542 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
10543 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
10544 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
10545 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
10546 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
10547 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 10548 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
10549 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
10550 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
10551 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 10552 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
10553 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
10554 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
10555 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
10556 | ||
10557 | /* "neighbor route-reflector" commands.*/ | |
10558 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
10559 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
10560 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
10561 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
10562 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
10563 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
10564 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
10565 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 10566 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
10567 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 10568 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
10569 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
10570 | ||
10571 | /* "neighbor route-server" commands.*/ | |
10572 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
10573 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
10574 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
10575 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
10576 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
10577 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
10578 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
10579 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 10580 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
10581 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 10582 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
10583 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
10584 | ||
10585 | /* "neighbor passive" commands. */ | |
10586 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
10587 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
10588 | ||
d5a5c8f0 DS |
10589 | /* "neighbor bfd" commands. */ |
10590 | install_element (BGP_NODE, &neighbor_bfd_cmd); | |
10591 | install_element (BGP_NODE, &no_neighbor_bfd_cmd); | |
10592 | ||
718e3744 | 10593 | /* "neighbor shutdown" commands. */ |
10594 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
10595 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
10596 | ||
c9502438 | 10597 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 10598 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
10599 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
10600 | ||
10601 | /* "neighbor capability orf prefix-list" commands.*/ | |
10602 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
10603 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
10604 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
10605 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
10606 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
10607 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
10608 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
10609 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 10610 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
10611 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 10612 | |
10613 | /* "neighbor capability dynamic" commands.*/ | |
10614 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
10615 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
10616 | ||
10617 | /* "neighbor dont-capability-negotiate" commands. */ | |
10618 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
10619 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
10620 | ||
10621 | /* "neighbor ebgp-multihop" commands. */ | |
10622 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
10623 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
10624 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
10625 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
10626 | ||
6ffd2079 | 10627 | /* "neighbor disable-connected-check" commands. */ |
10628 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
10629 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 10630 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
10631 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
10632 | ||
10633 | /* "neighbor description" commands. */ | |
10634 | install_element (BGP_NODE, &neighbor_description_cmd); | |
10635 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
10636 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
10637 | ||
10638 | /* "neighbor update-source" commands. "*/ | |
10639 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
10640 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
10641 | ||
10642 | /* "neighbor default-originate" commands. */ | |
10643 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
10644 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
10645 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
10646 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
10647 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
10648 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
10649 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
10650 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
10651 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
10652 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
10653 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
10654 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
10655 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
10656 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
10657 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
10658 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 10659 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
10660 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
10661 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
10662 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 10663 | |
10664 | /* "neighbor port" commands. */ | |
10665 | install_element (BGP_NODE, &neighbor_port_cmd); | |
10666 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
10667 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
10668 | ||
10669 | /* "neighbor weight" commands. */ | |
10670 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
10671 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
10672 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
10673 | ||
10674 | /* "neighbor override-capability" commands. */ | |
10675 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
10676 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
10677 | ||
10678 | /* "neighbor strict-capability-match" commands. */ | |
10679 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
10680 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
10681 | ||
10682 | /* "neighbor timers" commands. */ | |
10683 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
10684 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
10685 | ||
10686 | /* "neighbor timers connect" commands. */ | |
10687 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
10688 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
10689 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
10690 | ||
10691 | /* "neighbor advertisement-interval" commands. */ | |
10692 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
10693 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
10694 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
10695 | ||
10696 | /* "neighbor version" commands. */ | |
10697 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 10698 | |
10699 | /* "neighbor interface" commands. */ | |
10700 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
10701 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
10702 | ||
10703 | /* "neighbor distribute" commands. */ | |
10704 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
10705 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
10706 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
10707 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
10708 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
10709 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
10710 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
10711 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 10712 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
10713 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 10714 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
10715 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
10716 | ||
10717 | /* "neighbor prefix-list" commands. */ | |
10718 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
10719 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
10720 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
10721 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
10722 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
10723 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
10724 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
10725 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 10726 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
10727 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 10728 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
10729 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
10730 | ||
10731 | /* "neighbor filter-list" commands. */ | |
10732 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
10733 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
10734 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
10735 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
10736 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
10737 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
10738 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
10739 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 10740 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
10741 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 10742 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
10743 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
10744 | ||
10745 | /* "neighbor route-map" commands. */ | |
10746 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
10747 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
10748 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
10749 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
10750 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
10751 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
10752 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
10753 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 10754 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
10755 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 10756 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
10757 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
10758 | ||
10759 | /* "neighbor unsuppress-map" commands. */ | |
10760 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
10761 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
10762 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
10763 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
10764 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
10765 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
10766 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
10767 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 10768 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
10769 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 10770 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
10771 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 10772 | |
10773 | /* "neighbor maximum-prefix" commands. */ | |
10774 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 10775 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10776 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10777 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10778 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
10779 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10780 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
10781 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10782 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10783 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10784 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10785 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10786 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10787 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10788 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10789 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10790 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10791 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
10792 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10793 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
10794 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10795 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10796 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10797 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10798 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10799 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10800 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10801 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10802 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10803 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10804 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
10805 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10806 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
10807 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10808 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10809 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10810 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10811 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10812 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10813 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10814 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10815 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10816 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10817 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
10818 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10819 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
10820 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10821 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10822 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10823 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10824 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10825 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 10826 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
10827 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
10828 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
10829 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
10830 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
10831 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
10832 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
10833 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
10834 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
10835 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10836 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10837 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10838 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10839 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10840 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10841 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10842 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10843 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
10844 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10845 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
10846 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10847 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10848 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10849 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10850 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10851 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10852 | |
10853 | /* "neighbor allowas-in" */ | |
10854 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
10855 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
10856 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
10857 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
10858 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
10859 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
10860 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
10861 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
10862 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
10863 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
10864 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
10865 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 10866 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
10867 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
10868 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 10869 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
10870 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
10871 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
10872 | ||
10873 | /* address-family commands. */ | |
10874 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
10875 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
10876 | #ifdef HAVE_IPV6 | |
10877 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 10878 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 10879 | #endif /* HAVE_IPV6 */ |
10880 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
10881 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
10882 | ||
10883 | /* "exit-address-family" command. */ | |
10884 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
10885 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
10886 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 10887 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 10888 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
10889 | ||
10890 | /* "clear ip bgp commands" */ | |
10891 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
10892 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
10893 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
10894 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
10895 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
10896 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
10897 | #ifdef HAVE_IPV6 | |
10898 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
10899 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
10900 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
10901 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
10902 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
10903 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
10904 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
10905 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
10906 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
10907 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
10908 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
10909 | #endif /* HAVE_IPV6 */ | |
10910 | ||
10911 | /* "clear ip bgp neighbor soft in" */ | |
10912 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
10913 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
10914 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
10915 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
10916 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
10917 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
10918 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
10919 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
10920 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
10921 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
10922 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
10923 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
10924 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
10925 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
10926 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
10927 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
10928 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
10929 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
10930 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
10931 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
10932 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
10933 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
10934 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
10935 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
10936 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
10937 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
10938 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
10939 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
10940 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
10941 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
10942 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
10943 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
10944 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
10945 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
10946 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
10947 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
10948 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
10949 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
10950 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
10951 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
10952 | #ifdef HAVE_IPV6 | |
10953 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
10954 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
10955 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
10956 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
10957 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
10958 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
10959 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
10960 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
10961 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
10962 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
10963 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
10964 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
10965 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
10966 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
10967 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
10968 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
10969 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
10970 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
10971 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
10972 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
10973 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
10974 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
10975 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
10976 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
10977 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
10978 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
10979 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
10980 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
10981 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
10982 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
10983 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
10984 | #endif /* HAVE_IPV6 */ | |
10985 | ||
8ad7271d DS |
10986 | /* clear ip bgp prefix */ |
10987 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
10988 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); | |
10989 | ||
718e3744 | 10990 | /* "clear ip bgp neighbor soft out" */ |
10991 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
10992 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
10993 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
10994 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
10995 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
10996 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
10997 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
10998 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
10999 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
11000 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
11001 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
11002 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
11003 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
11004 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
11005 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
11006 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
11007 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
11008 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
11009 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
11010 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
11011 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
11012 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
11013 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
11014 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
11015 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
11016 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
11017 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
11018 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
11019 | #ifdef HAVE_IPV6 | |
11020 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
11021 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
11022 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
11023 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
11024 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
11025 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
11026 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
11027 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
11028 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
11029 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
11030 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
11031 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
11032 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
11033 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
11034 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
11035 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
11036 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
11037 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
11038 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
11039 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
11040 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
11041 | #endif /* HAVE_IPV6 */ | |
11042 | ||
11043 | /* "clear ip bgp neighbor soft" */ | |
11044 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
11045 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
11046 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
11047 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
11048 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
11049 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
11050 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
11051 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
11052 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
11053 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
11054 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
11055 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
11056 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
11057 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
11058 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
11059 | #ifdef HAVE_IPV6 | |
11060 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
11061 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
11062 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
11063 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
11064 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
11065 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
11066 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
11067 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
11068 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
11069 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
11070 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
11071 | #endif /* HAVE_IPV6 */ | |
11072 | ||
fee0f4c6 | 11073 | /* "clear ip bgp neighbor rsclient" */ |
11074 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
11075 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
11076 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
11077 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
11078 | #ifdef HAVE_IPV6 | |
11079 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
11080 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
11081 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
11082 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
11083 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
11084 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
11085 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
11086 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
11087 | #endif /* HAVE_IPV6 */ | |
11088 | ||
718e3744 | 11089 | /* "show ip bgp summary" commands. */ |
11090 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 11091 | install_element (VIEW_NODE, &show_ip_bgp_summary_csv_cmd); |
718e3744 | 11092 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
11093 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 11094 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 11095 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 11096 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 11097 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
11098 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
11099 | #ifdef HAVE_IPV6 | |
11100 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 11101 | install_element (VIEW_NODE, &show_bgp_summary_csv_cmd); |
718e3744 | 11102 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
11103 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 11104 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 11105 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 11106 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
11107 | #endif /* HAVE_IPV6 */ |
11108 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 11109 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_csv_cmd); |
62687ff1 PJ |
11110 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
11111 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 11112 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 11113 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 11114 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
11115 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
11116 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
11117 | #ifdef HAVE_IPV6 | |
11118 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 11119 | install_element (RESTRICTED_NODE, &show_bgp_summary_csv_cmd); |
62687ff1 PJ |
11120 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
11121 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 11122 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 11123 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 11124 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 11125 | #endif /* HAVE_IPV6 */ |
11126 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 11127 | install_element (ENABLE_NODE, &show_ip_bgp_summary_csv_cmd); |
718e3744 | 11128 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
11129 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 11130 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 11131 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 11132 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 11133 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
11134 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
11135 | #ifdef HAVE_IPV6 | |
11136 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 11137 | install_element (ENABLE_NODE, &show_bgp_summary_csv_cmd); |
718e3744 | 11138 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
11139 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 11140 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 11141 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 11142 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 11143 | #endif /* HAVE_IPV6 */ |
11144 | ||
11145 | /* "show ip bgp neighbors" commands. */ | |
11146 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
11147 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
11148 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
11149 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
11150 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
11151 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
11152 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
11153 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
11154 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
11155 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
11156 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
11157 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
11158 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
11159 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
11160 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 11161 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
11162 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
11163 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
11164 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
11165 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
11166 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
11167 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
11168 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
11169 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
11170 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
11171 | ||
11172 | #ifdef HAVE_IPV6 | |
11173 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
11174 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
11175 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
11176 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 11177 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
11178 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
11179 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
11180 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
11181 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
11182 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
11183 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
11184 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 11185 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
11186 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
11187 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
11188 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 11189 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
11190 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
11191 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
11192 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 11193 | |
11194 | /* Old commands. */ | |
11195 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
11196 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
11197 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
11198 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
11199 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 11200 | |
11201 | /* "show ip bgp rsclient" commands. */ | |
11202 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
11203 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
11204 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
11205 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
11206 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
11207 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
11208 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
11209 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
11210 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
11211 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
11212 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
11213 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 11214 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
11215 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
11216 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
11217 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
11218 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
11219 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 11220 | |
11221 | #ifdef HAVE_IPV6 | |
11222 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
11223 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
11224 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
11225 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
11226 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
11227 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
11228 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
11229 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
11230 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
11231 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
11232 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
11233 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 11234 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
11235 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
11236 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
11237 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
11238 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
11239 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 11240 | #endif /* HAVE_IPV6 */ |
718e3744 | 11241 | |
11242 | /* "show ip bgp paths" commands. */ | |
11243 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
11244 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
11245 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
11246 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
11247 | ||
11248 | /* "show ip bgp community" commands. */ | |
11249 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
11250 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
11251 | ||
11252 | /* "show ip bgp attribute-info" commands. */ | |
11253 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
11254 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
11255 | ||
11256 | /* "redistribute" commands. */ | |
11257 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
11258 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
11259 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
11260 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
11261 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
11262 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
11263 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
11264 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
11265 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
11266 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
11267 | #ifdef HAVE_IPV6 | |
11268 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
11269 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
11270 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
11271 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
11272 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
11273 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
11274 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
11275 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
11276 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
11277 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
11278 | #endif /* HAVE_IPV6 */ | |
11279 | ||
fa411a21 NH |
11280 | /* ttl_security commands */ |
11281 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
11282 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
11283 | ||
4bf6a362 PJ |
11284 | /* "show bgp memory" commands. */ |
11285 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 11286 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
11287 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
11288 | ||
e0081f70 ML |
11289 | /* "show bgp views" commands. */ |
11290 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
11291 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
11292 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
11293 | ||
718e3744 | 11294 | /* Community-list. */ |
11295 | community_list_vty (); | |
11296 | } | |
6b0655a2 | 11297 | |
718e3744 | 11298 | #include "memory.h" |
11299 | #include "bgp_regex.h" | |
11300 | #include "bgp_clist.h" | |
11301 | #include "bgp_ecommunity.h" | |
11302 | ||
11303 | /* VTY functions. */ | |
11304 | ||
11305 | /* Direction value to string conversion. */ | |
94f2b392 | 11306 | static const char * |
718e3744 | 11307 | community_direct_str (int direct) |
11308 | { | |
11309 | switch (direct) | |
11310 | { | |
11311 | case COMMUNITY_DENY: | |
11312 | return "deny"; | |
718e3744 | 11313 | case COMMUNITY_PERMIT: |
11314 | return "permit"; | |
718e3744 | 11315 | default: |
11316 | return "unknown"; | |
718e3744 | 11317 | } |
11318 | } | |
11319 | ||
11320 | /* Display error string. */ | |
94f2b392 | 11321 | static void |
718e3744 | 11322 | community_list_perror (struct vty *vty, int ret) |
11323 | { | |
11324 | switch (ret) | |
11325 | { | |
11326 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 11327 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 11328 | break; |
11329 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
11330 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
11331 | break; | |
11332 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
11333 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
11334 | break; | |
11335 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
11336 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
11337 | break; | |
11338 | } | |
11339 | } | |
11340 | ||
11341 | /* VTY interface for community_set() function. */ | |
94f2b392 | 11342 | static int |
fd79ac91 | 11343 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
11344 | int style, int reject_all_digit_name) | |
718e3744 | 11345 | { |
11346 | int ret; | |
11347 | int direct; | |
11348 | char *str; | |
11349 | ||
11350 | /* Check the list type. */ | |
11351 | if (strncmp (argv[1], "p", 1) == 0) | |
11352 | direct = COMMUNITY_PERMIT; | |
11353 | else if (strncmp (argv[1], "d", 1) == 0) | |
11354 | direct = COMMUNITY_DENY; | |
11355 | else | |
11356 | { | |
11357 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
11358 | VTY_NEWLINE); | |
11359 | return CMD_WARNING; | |
11360 | } | |
11361 | ||
11362 | /* All digit name check. */ | |
11363 | if (reject_all_digit_name && all_digit (argv[0])) | |
11364 | { | |
11365 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
11366 | return CMD_WARNING; | |
11367 | } | |
11368 | ||
11369 | /* Concat community string argument. */ | |
11370 | if (argc > 1) | |
11371 | str = argv_concat (argv, argc, 2); | |
11372 | else | |
11373 | str = NULL; | |
11374 | ||
11375 | /* When community_list_set() return nevetive value, it means | |
11376 | malformed community string. */ | |
11377 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
11378 | ||
11379 | /* Free temporary community list string allocated by | |
11380 | argv_concat(). */ | |
11381 | if (str) | |
11382 | XFREE (MTYPE_TMP, str); | |
11383 | ||
11384 | if (ret < 0) | |
11385 | { | |
11386 | /* Display error string. */ | |
11387 | community_list_perror (vty, ret); | |
11388 | return CMD_WARNING; | |
11389 | } | |
11390 | ||
11391 | return CMD_SUCCESS; | |
11392 | } | |
11393 | ||
718e3744 | 11394 | /* Communiyt-list entry delete. */ |
94f2b392 | 11395 | static int |
fee6e4e4 | 11396 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
11397 | int style) | |
718e3744 | 11398 | { |
11399 | int ret; | |
fee6e4e4 | 11400 | int direct = 0; |
11401 | char *str = NULL; | |
718e3744 | 11402 | |
fee6e4e4 | 11403 | if (argc > 1) |
718e3744 | 11404 | { |
fee6e4e4 | 11405 | /* Check the list direct. */ |
11406 | if (strncmp (argv[1], "p", 1) == 0) | |
11407 | direct = COMMUNITY_PERMIT; | |
11408 | else if (strncmp (argv[1], "d", 1) == 0) | |
11409 | direct = COMMUNITY_DENY; | |
11410 | else | |
11411 | { | |
11412 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
11413 | VTY_NEWLINE); | |
11414 | return CMD_WARNING; | |
11415 | } | |
718e3744 | 11416 | |
fee6e4e4 | 11417 | /* Concat community string argument. */ |
11418 | str = argv_concat (argv, argc, 2); | |
11419 | } | |
718e3744 | 11420 | |
11421 | /* Unset community list. */ | |
11422 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
11423 | ||
11424 | /* Free temporary community list string allocated by | |
11425 | argv_concat(). */ | |
fee6e4e4 | 11426 | if (str) |
11427 | XFREE (MTYPE_TMP, str); | |
718e3744 | 11428 | |
11429 | if (ret < 0) | |
11430 | { | |
11431 | community_list_perror (vty, ret); | |
11432 | return CMD_WARNING; | |
11433 | } | |
11434 | ||
11435 | return CMD_SUCCESS; | |
11436 | } | |
11437 | ||
11438 | /* "community-list" keyword help string. */ | |
11439 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
11440 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
11441 | ||
718e3744 | 11442 | DEFUN (ip_community_list_standard, |
11443 | ip_community_list_standard_cmd, | |
11444 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
11445 | IP_STR | |
11446 | COMMUNITY_LIST_STR | |
11447 | "Community list number (standard)\n" | |
11448 | "Specify community to reject\n" | |
11449 | "Specify community to accept\n" | |
11450 | COMMUNITY_VAL_STR) | |
11451 | { | |
11452 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
11453 | } | |
11454 | ||
11455 | ALIAS (ip_community_list_standard, | |
11456 | ip_community_list_standard2_cmd, | |
11457 | "ip community-list <1-99> (deny|permit)", | |
11458 | IP_STR | |
11459 | COMMUNITY_LIST_STR | |
11460 | "Community list number (standard)\n" | |
11461 | "Specify community to reject\n" | |
11462 | "Specify community to accept\n") | |
11463 | ||
11464 | DEFUN (ip_community_list_expanded, | |
11465 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 11466 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 11467 | IP_STR |
11468 | COMMUNITY_LIST_STR | |
11469 | "Community list number (expanded)\n" | |
11470 | "Specify community to reject\n" | |
11471 | "Specify community to accept\n" | |
11472 | "An ordered list as a regular-expression\n") | |
11473 | { | |
11474 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
11475 | } | |
11476 | ||
11477 | DEFUN (ip_community_list_name_standard, | |
11478 | ip_community_list_name_standard_cmd, | |
11479 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
11480 | IP_STR | |
11481 | COMMUNITY_LIST_STR | |
11482 | "Add a standard community-list entry\n" | |
11483 | "Community list name\n" | |
11484 | "Specify community to reject\n" | |
11485 | "Specify community to accept\n" | |
11486 | COMMUNITY_VAL_STR) | |
11487 | { | |
11488 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
11489 | } | |
11490 | ||
11491 | ALIAS (ip_community_list_name_standard, | |
11492 | ip_community_list_name_standard2_cmd, | |
11493 | "ip community-list standard WORD (deny|permit)", | |
11494 | IP_STR | |
11495 | COMMUNITY_LIST_STR | |
11496 | "Add a standard community-list entry\n" | |
11497 | "Community list name\n" | |
11498 | "Specify community to reject\n" | |
11499 | "Specify community to accept\n") | |
11500 | ||
11501 | DEFUN (ip_community_list_name_expanded, | |
11502 | ip_community_list_name_expanded_cmd, | |
11503 | "ip community-list expanded WORD (deny|permit) .LINE", | |
11504 | IP_STR | |
11505 | COMMUNITY_LIST_STR | |
11506 | "Add an expanded community-list entry\n" | |
11507 | "Community list name\n" | |
11508 | "Specify community to reject\n" | |
11509 | "Specify community to accept\n" | |
11510 | "An ordered list as a regular-expression\n") | |
11511 | { | |
11512 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
11513 | } | |
11514 | ||
fee6e4e4 | 11515 | DEFUN (no_ip_community_list_standard_all, |
11516 | no_ip_community_list_standard_all_cmd, | |
11517 | "no ip community-list <1-99>", | |
11518 | NO_STR | |
11519 | IP_STR | |
11520 | COMMUNITY_LIST_STR | |
11521 | "Community list number (standard)\n") | |
11522 | { | |
11523 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
11524 | } | |
11525 | ||
11526 | DEFUN (no_ip_community_list_expanded_all, | |
11527 | no_ip_community_list_expanded_all_cmd, | |
11528 | "no ip community-list <100-500>", | |
718e3744 | 11529 | NO_STR |
11530 | IP_STR | |
11531 | COMMUNITY_LIST_STR | |
718e3744 | 11532 | "Community list number (expanded)\n") |
11533 | { | |
fee6e4e4 | 11534 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 11535 | } |
11536 | ||
fee6e4e4 | 11537 | DEFUN (no_ip_community_list_name_standard_all, |
11538 | no_ip_community_list_name_standard_all_cmd, | |
11539 | "no ip community-list standard WORD", | |
718e3744 | 11540 | NO_STR |
11541 | IP_STR | |
11542 | COMMUNITY_LIST_STR | |
11543 | "Add a standard community-list entry\n" | |
718e3744 | 11544 | "Community list name\n") |
11545 | { | |
fee6e4e4 | 11546 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 11547 | } |
11548 | ||
fee6e4e4 | 11549 | DEFUN (no_ip_community_list_name_expanded_all, |
11550 | no_ip_community_list_name_expanded_all_cmd, | |
11551 | "no ip community-list expanded WORD", | |
718e3744 | 11552 | NO_STR |
11553 | IP_STR | |
11554 | COMMUNITY_LIST_STR | |
fee6e4e4 | 11555 | "Add an expanded community-list entry\n" |
11556 | "Community list name\n") | |
718e3744 | 11557 | { |
fee6e4e4 | 11558 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 11559 | } |
11560 | ||
11561 | DEFUN (no_ip_community_list_standard, | |
11562 | no_ip_community_list_standard_cmd, | |
11563 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
11564 | NO_STR | |
11565 | IP_STR | |
11566 | COMMUNITY_LIST_STR | |
11567 | "Community list number (standard)\n" | |
11568 | "Specify community to reject\n" | |
11569 | "Specify community to accept\n" | |
11570 | COMMUNITY_VAL_STR) | |
11571 | { | |
11572 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
11573 | } | |
11574 | ||
11575 | DEFUN (no_ip_community_list_expanded, | |
11576 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 11577 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 11578 | NO_STR |
11579 | IP_STR | |
11580 | COMMUNITY_LIST_STR | |
11581 | "Community list number (expanded)\n" | |
11582 | "Specify community to reject\n" | |
11583 | "Specify community to accept\n" | |
11584 | "An ordered list as a regular-expression\n") | |
11585 | { | |
11586 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
11587 | } | |
11588 | ||
11589 | DEFUN (no_ip_community_list_name_standard, | |
11590 | no_ip_community_list_name_standard_cmd, | |
11591 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
11592 | NO_STR | |
11593 | IP_STR | |
11594 | COMMUNITY_LIST_STR | |
11595 | "Specify a standard community-list\n" | |
11596 | "Community list name\n" | |
11597 | "Specify community to reject\n" | |
11598 | "Specify community to accept\n" | |
11599 | COMMUNITY_VAL_STR) | |
11600 | { | |
11601 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
11602 | } | |
11603 | ||
11604 | DEFUN (no_ip_community_list_name_expanded, | |
11605 | no_ip_community_list_name_expanded_cmd, | |
11606 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
11607 | NO_STR | |
11608 | IP_STR | |
11609 | COMMUNITY_LIST_STR | |
11610 | "Specify an expanded community-list\n" | |
11611 | "Community list name\n" | |
11612 | "Specify community to reject\n" | |
11613 | "Specify community to accept\n" | |
11614 | "An ordered list as a regular-expression\n") | |
11615 | { | |
11616 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
11617 | } | |
11618 | ||
94f2b392 | 11619 | static void |
718e3744 | 11620 | community_list_show (struct vty *vty, struct community_list *list) |
11621 | { | |
11622 | struct community_entry *entry; | |
11623 | ||
11624 | for (entry = list->head; entry; entry = entry->next) | |
11625 | { | |
11626 | if (entry == list->head) | |
11627 | { | |
11628 | if (all_digit (list->name)) | |
11629 | vty_out (vty, "Community %s list %s%s", | |
11630 | entry->style == COMMUNITY_LIST_STANDARD ? | |
11631 | "standard" : "(expanded) access", | |
11632 | list->name, VTY_NEWLINE); | |
11633 | else | |
11634 | vty_out (vty, "Named Community %s list %s%s", | |
11635 | entry->style == COMMUNITY_LIST_STANDARD ? | |
11636 | "standard" : "expanded", | |
11637 | list->name, VTY_NEWLINE); | |
11638 | } | |
11639 | if (entry->any) | |
11640 | vty_out (vty, " %s%s", | |
11641 | community_direct_str (entry->direct), VTY_NEWLINE); | |
11642 | else | |
11643 | vty_out (vty, " %s %s%s", | |
11644 | community_direct_str (entry->direct), | |
11645 | entry->style == COMMUNITY_LIST_STANDARD | |
11646 | ? community_str (entry->u.com) : entry->config, | |
11647 | VTY_NEWLINE); | |
11648 | } | |
11649 | } | |
11650 | ||
11651 | DEFUN (show_ip_community_list, | |
11652 | show_ip_community_list_cmd, | |
11653 | "show ip community-list", | |
11654 | SHOW_STR | |
11655 | IP_STR | |
11656 | "List community-list\n") | |
11657 | { | |
11658 | struct community_list *list; | |
11659 | struct community_list_master *cm; | |
11660 | ||
fee6e4e4 | 11661 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 11662 | if (! cm) |
11663 | return CMD_SUCCESS; | |
11664 | ||
11665 | for (list = cm->num.head; list; list = list->next) | |
11666 | community_list_show (vty, list); | |
11667 | ||
11668 | for (list = cm->str.head; list; list = list->next) | |
11669 | community_list_show (vty, list); | |
11670 | ||
11671 | return CMD_SUCCESS; | |
11672 | } | |
11673 | ||
11674 | DEFUN (show_ip_community_list_arg, | |
11675 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 11676 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 11677 | SHOW_STR |
11678 | IP_STR | |
11679 | "List community-list\n" | |
11680 | "Community-list number\n" | |
11681 | "Community-list name\n") | |
11682 | { | |
11683 | struct community_list *list; | |
11684 | ||
fee6e4e4 | 11685 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 11686 | if (! list) |
11687 | { | |
b729294c | 11688 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 11689 | return CMD_WARNING; |
11690 | } | |
11691 | ||
11692 | community_list_show (vty, list); | |
11693 | ||
11694 | return CMD_SUCCESS; | |
11695 | } | |
6b0655a2 | 11696 | |
94f2b392 | 11697 | static int |
fd79ac91 | 11698 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
11699 | int style, int reject_all_digit_name) | |
718e3744 | 11700 | { |
11701 | int ret; | |
11702 | int direct; | |
11703 | char *str; | |
11704 | ||
11705 | /* Check the list type. */ | |
11706 | if (strncmp (argv[1], "p", 1) == 0) | |
11707 | direct = COMMUNITY_PERMIT; | |
11708 | else if (strncmp (argv[1], "d", 1) == 0) | |
11709 | direct = COMMUNITY_DENY; | |
11710 | else | |
11711 | { | |
11712 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
11713 | VTY_NEWLINE); | |
11714 | return CMD_WARNING; | |
11715 | } | |
11716 | ||
11717 | /* All digit name check. */ | |
11718 | if (reject_all_digit_name && all_digit (argv[0])) | |
11719 | { | |
11720 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
11721 | return CMD_WARNING; | |
11722 | } | |
11723 | ||
11724 | /* Concat community string argument. */ | |
11725 | if (argc > 1) | |
11726 | str = argv_concat (argv, argc, 2); | |
11727 | else | |
11728 | str = NULL; | |
11729 | ||
11730 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
11731 | ||
11732 | /* Free temporary community list string allocated by | |
11733 | argv_concat(). */ | |
11734 | if (str) | |
11735 | XFREE (MTYPE_TMP, str); | |
11736 | ||
11737 | if (ret < 0) | |
11738 | { | |
11739 | community_list_perror (vty, ret); | |
11740 | return CMD_WARNING; | |
11741 | } | |
11742 | return CMD_SUCCESS; | |
11743 | } | |
11744 | ||
94f2b392 | 11745 | static int |
fee6e4e4 | 11746 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
11747 | int style) | |
718e3744 | 11748 | { |
11749 | int ret; | |
fee6e4e4 | 11750 | int direct = 0; |
11751 | char *str = NULL; | |
718e3744 | 11752 | |
fee6e4e4 | 11753 | if (argc > 1) |
718e3744 | 11754 | { |
fee6e4e4 | 11755 | /* Check the list direct. */ |
11756 | if (strncmp (argv[1], "p", 1) == 0) | |
11757 | direct = COMMUNITY_PERMIT; | |
11758 | else if (strncmp (argv[1], "d", 1) == 0) | |
11759 | direct = COMMUNITY_DENY; | |
11760 | else | |
11761 | { | |
11762 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
11763 | VTY_NEWLINE); | |
11764 | return CMD_WARNING; | |
11765 | } | |
718e3744 | 11766 | |
fee6e4e4 | 11767 | /* Concat community string argument. */ |
11768 | str = argv_concat (argv, argc, 2); | |
718e3744 | 11769 | } |
11770 | ||
718e3744 | 11771 | /* Unset community list. */ |
11772 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
11773 | ||
11774 | /* Free temporary community list string allocated by | |
11775 | argv_concat(). */ | |
fee6e4e4 | 11776 | if (str) |
11777 | XFREE (MTYPE_TMP, str); | |
718e3744 | 11778 | |
11779 | if (ret < 0) | |
11780 | { | |
11781 | community_list_perror (vty, ret); | |
11782 | return CMD_WARNING; | |
11783 | } | |
11784 | ||
11785 | return CMD_SUCCESS; | |
11786 | } | |
11787 | ||
11788 | /* "extcommunity-list" keyword help string. */ | |
11789 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
11790 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
11791 | ||
11792 | DEFUN (ip_extcommunity_list_standard, | |
11793 | ip_extcommunity_list_standard_cmd, | |
11794 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
11795 | IP_STR | |
11796 | EXTCOMMUNITY_LIST_STR | |
11797 | "Extended Community list number (standard)\n" | |
11798 | "Specify community to reject\n" | |
11799 | "Specify community to accept\n" | |
11800 | EXTCOMMUNITY_VAL_STR) | |
11801 | { | |
11802 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
11803 | } | |
11804 | ||
11805 | ALIAS (ip_extcommunity_list_standard, | |
11806 | ip_extcommunity_list_standard2_cmd, | |
11807 | "ip extcommunity-list <1-99> (deny|permit)", | |
11808 | IP_STR | |
11809 | EXTCOMMUNITY_LIST_STR | |
11810 | "Extended Community list number (standard)\n" | |
11811 | "Specify community to reject\n" | |
11812 | "Specify community to accept\n") | |
11813 | ||
11814 | DEFUN (ip_extcommunity_list_expanded, | |
11815 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 11816 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 11817 | IP_STR |
11818 | EXTCOMMUNITY_LIST_STR | |
11819 | "Extended Community list number (expanded)\n" | |
11820 | "Specify community to reject\n" | |
11821 | "Specify community to accept\n" | |
11822 | "An ordered list as a regular-expression\n") | |
11823 | { | |
11824 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
11825 | } | |
11826 | ||
11827 | DEFUN (ip_extcommunity_list_name_standard, | |
11828 | ip_extcommunity_list_name_standard_cmd, | |
11829 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
11830 | IP_STR | |
11831 | EXTCOMMUNITY_LIST_STR | |
11832 | "Specify standard extcommunity-list\n" | |
11833 | "Extended Community list name\n" | |
11834 | "Specify community to reject\n" | |
11835 | "Specify community to accept\n" | |
11836 | EXTCOMMUNITY_VAL_STR) | |
11837 | { | |
11838 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
11839 | } | |
11840 | ||
11841 | ALIAS (ip_extcommunity_list_name_standard, | |
11842 | ip_extcommunity_list_name_standard2_cmd, | |
11843 | "ip extcommunity-list standard WORD (deny|permit)", | |
11844 | IP_STR | |
11845 | EXTCOMMUNITY_LIST_STR | |
11846 | "Specify standard extcommunity-list\n" | |
11847 | "Extended Community list name\n" | |
11848 | "Specify community to reject\n" | |
11849 | "Specify community to accept\n") | |
11850 | ||
11851 | DEFUN (ip_extcommunity_list_name_expanded, | |
11852 | ip_extcommunity_list_name_expanded_cmd, | |
11853 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
11854 | IP_STR | |
11855 | EXTCOMMUNITY_LIST_STR | |
11856 | "Specify expanded extcommunity-list\n" | |
11857 | "Extended Community list name\n" | |
11858 | "Specify community to reject\n" | |
11859 | "Specify community to accept\n" | |
11860 | "An ordered list as a regular-expression\n") | |
11861 | { | |
11862 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
11863 | } | |
11864 | ||
fee6e4e4 | 11865 | DEFUN (no_ip_extcommunity_list_standard_all, |
11866 | no_ip_extcommunity_list_standard_all_cmd, | |
11867 | "no ip extcommunity-list <1-99>", | |
11868 | NO_STR | |
11869 | IP_STR | |
11870 | EXTCOMMUNITY_LIST_STR | |
11871 | "Extended Community list number (standard)\n") | |
11872 | { | |
11873 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11874 | } | |
11875 | ||
11876 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
11877 | no_ip_extcommunity_list_expanded_all_cmd, | |
11878 | "no ip extcommunity-list <100-500>", | |
718e3744 | 11879 | NO_STR |
11880 | IP_STR | |
11881 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 11882 | "Extended Community list number (expanded)\n") |
11883 | { | |
fee6e4e4 | 11884 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 11885 | } |
11886 | ||
fee6e4e4 | 11887 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
11888 | no_ip_extcommunity_list_name_standard_all_cmd, | |
11889 | "no ip extcommunity-list standard WORD", | |
718e3744 | 11890 | NO_STR |
11891 | IP_STR | |
11892 | EXTCOMMUNITY_LIST_STR | |
11893 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 11894 | "Extended Community list name\n") |
11895 | { | |
11896 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11897 | } | |
11898 | ||
11899 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
11900 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
11901 | "no ip extcommunity-list expanded WORD", | |
11902 | NO_STR | |
11903 | IP_STR | |
11904 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 11905 | "Specify expanded extcommunity-list\n" |
11906 | "Extended Community list name\n") | |
11907 | { | |
fee6e4e4 | 11908 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 11909 | } |
11910 | ||
11911 | DEFUN (no_ip_extcommunity_list_standard, | |
11912 | no_ip_extcommunity_list_standard_cmd, | |
11913 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
11914 | NO_STR | |
11915 | IP_STR | |
11916 | EXTCOMMUNITY_LIST_STR | |
11917 | "Extended Community list number (standard)\n" | |
11918 | "Specify community to reject\n" | |
11919 | "Specify community to accept\n" | |
11920 | EXTCOMMUNITY_VAL_STR) | |
11921 | { | |
11922 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11923 | } | |
11924 | ||
11925 | DEFUN (no_ip_extcommunity_list_expanded, | |
11926 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 11927 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 11928 | NO_STR |
11929 | IP_STR | |
11930 | EXTCOMMUNITY_LIST_STR | |
11931 | "Extended Community list number (expanded)\n" | |
11932 | "Specify community to reject\n" | |
11933 | "Specify community to accept\n" | |
11934 | "An ordered list as a regular-expression\n") | |
11935 | { | |
11936 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
11937 | } | |
11938 | ||
11939 | DEFUN (no_ip_extcommunity_list_name_standard, | |
11940 | no_ip_extcommunity_list_name_standard_cmd, | |
11941 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
11942 | NO_STR | |
11943 | IP_STR | |
11944 | EXTCOMMUNITY_LIST_STR | |
11945 | "Specify standard extcommunity-list\n" | |
11946 | "Extended Community list name\n" | |
11947 | "Specify community to reject\n" | |
11948 | "Specify community to accept\n" | |
11949 | EXTCOMMUNITY_VAL_STR) | |
11950 | { | |
11951 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11952 | } | |
11953 | ||
11954 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
11955 | no_ip_extcommunity_list_name_expanded_cmd, | |
11956 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
11957 | NO_STR | |
11958 | IP_STR | |
11959 | EXTCOMMUNITY_LIST_STR | |
11960 | "Specify expanded extcommunity-list\n" | |
11961 | "Community list name\n" | |
11962 | "Specify community to reject\n" | |
11963 | "Specify community to accept\n" | |
11964 | "An ordered list as a regular-expression\n") | |
11965 | { | |
11966 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
11967 | } | |
11968 | ||
94f2b392 | 11969 | static void |
718e3744 | 11970 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
11971 | { | |
11972 | struct community_entry *entry; | |
11973 | ||
11974 | for (entry = list->head; entry; entry = entry->next) | |
11975 | { | |
11976 | if (entry == list->head) | |
11977 | { | |
11978 | if (all_digit (list->name)) | |
11979 | vty_out (vty, "Extended community %s list %s%s", | |
11980 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11981 | "standard" : "(expanded) access", | |
11982 | list->name, VTY_NEWLINE); | |
11983 | else | |
11984 | vty_out (vty, "Named extended community %s list %s%s", | |
11985 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11986 | "standard" : "expanded", | |
11987 | list->name, VTY_NEWLINE); | |
11988 | } | |
11989 | if (entry->any) | |
11990 | vty_out (vty, " %s%s", | |
11991 | community_direct_str (entry->direct), VTY_NEWLINE); | |
11992 | else | |
11993 | vty_out (vty, " %s %s%s", | |
11994 | community_direct_str (entry->direct), | |
11995 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11996 | entry->u.ecom->str : entry->config, | |
11997 | VTY_NEWLINE); | |
11998 | } | |
11999 | } | |
12000 | ||
12001 | DEFUN (show_ip_extcommunity_list, | |
12002 | show_ip_extcommunity_list_cmd, | |
12003 | "show ip extcommunity-list", | |
12004 | SHOW_STR | |
12005 | IP_STR | |
12006 | "List extended-community list\n") | |
12007 | { | |
12008 | struct community_list *list; | |
12009 | struct community_list_master *cm; | |
12010 | ||
fee6e4e4 | 12011 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 12012 | if (! cm) |
12013 | return CMD_SUCCESS; | |
12014 | ||
12015 | for (list = cm->num.head; list; list = list->next) | |
12016 | extcommunity_list_show (vty, list); | |
12017 | ||
12018 | for (list = cm->str.head; list; list = list->next) | |
12019 | extcommunity_list_show (vty, list); | |
12020 | ||
12021 | return CMD_SUCCESS; | |
12022 | } | |
12023 | ||
12024 | DEFUN (show_ip_extcommunity_list_arg, | |
12025 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 12026 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 12027 | SHOW_STR |
12028 | IP_STR | |
12029 | "List extended-community list\n" | |
12030 | "Extcommunity-list number\n" | |
12031 | "Extcommunity-list name\n") | |
12032 | { | |
12033 | struct community_list *list; | |
12034 | ||
fee6e4e4 | 12035 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 12036 | if (! list) |
12037 | { | |
b729294c | 12038 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 12039 | return CMD_WARNING; |
12040 | } | |
12041 | ||
12042 | extcommunity_list_show (vty, list); | |
12043 | ||
12044 | return CMD_SUCCESS; | |
12045 | } | |
6b0655a2 | 12046 | |
718e3744 | 12047 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 12048 | static const char * |
718e3744 | 12049 | community_list_config_str (struct community_entry *entry) |
12050 | { | |
fd79ac91 | 12051 | const char *str; |
718e3744 | 12052 | |
12053 | if (entry->any) | |
12054 | str = ""; | |
12055 | else | |
12056 | { | |
12057 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
12058 | str = community_str (entry->u.com); | |
12059 | else | |
12060 | str = entry->config; | |
12061 | } | |
12062 | return str; | |
12063 | } | |
12064 | ||
12065 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 12066 | static int |
718e3744 | 12067 | community_list_config_write (struct vty *vty) |
12068 | { | |
12069 | struct community_list *list; | |
12070 | struct community_entry *entry; | |
12071 | struct community_list_master *cm; | |
12072 | int write = 0; | |
12073 | ||
12074 | /* Community-list. */ | |
fee6e4e4 | 12075 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 12076 | |
12077 | for (list = cm->num.head; list; list = list->next) | |
12078 | for (entry = list->head; entry; entry = entry->next) | |
12079 | { | |
fee6e4e4 | 12080 | vty_out (vty, "ip community-list %s %s %s%s", |
12081 | list->name, community_direct_str (entry->direct), | |
12082 | community_list_config_str (entry), | |
12083 | VTY_NEWLINE); | |
718e3744 | 12084 | write++; |
12085 | } | |
12086 | for (list = cm->str.head; list; list = list->next) | |
12087 | for (entry = list->head; entry; entry = entry->next) | |
12088 | { | |
12089 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
12090 | entry->style == COMMUNITY_LIST_STANDARD | |
12091 | ? "standard" : "expanded", | |
12092 | list->name, community_direct_str (entry->direct), | |
12093 | community_list_config_str (entry), | |
12094 | VTY_NEWLINE); | |
12095 | write++; | |
12096 | } | |
12097 | ||
12098 | /* Extcommunity-list. */ | |
fee6e4e4 | 12099 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 12100 | |
12101 | for (list = cm->num.head; list; list = list->next) | |
12102 | for (entry = list->head; entry; entry = entry->next) | |
12103 | { | |
fee6e4e4 | 12104 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
12105 | list->name, community_direct_str (entry->direct), | |
12106 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 12107 | write++; |
12108 | } | |
12109 | for (list = cm->str.head; list; list = list->next) | |
12110 | for (entry = list->head; entry; entry = entry->next) | |
12111 | { | |
12112 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
12113 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
12114 | ? "standard" : "expanded", | |
12115 | list->name, community_direct_str (entry->direct), | |
12116 | community_list_config_str (entry), VTY_NEWLINE); | |
12117 | write++; | |
12118 | } | |
12119 | return write; | |
12120 | } | |
12121 | ||
7fc626de | 12122 | static struct cmd_node community_list_node = |
718e3744 | 12123 | { |
12124 | COMMUNITY_LIST_NODE, | |
12125 | "", | |
12126 | 1 /* Export to vtysh. */ | |
12127 | }; | |
12128 | ||
94f2b392 | 12129 | static void |
12130 | community_list_vty (void) | |
718e3744 | 12131 | { |
12132 | install_node (&community_list_node, community_list_config_write); | |
12133 | ||
12134 | /* Community-list. */ | |
718e3744 | 12135 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
12136 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
12137 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
12138 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
12139 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
12140 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 12141 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
12142 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
12143 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
12144 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 12145 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
12146 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
12147 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
12148 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
12149 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
12150 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
12151 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
12152 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
12153 | ||
12154 | /* Extcommunity-list. */ | |
12155 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
12156 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
12157 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
12158 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
12159 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
12160 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 12161 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
12162 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
12163 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
12164 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 12165 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
12166 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
12167 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
12168 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
12169 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
12170 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
12171 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
12172 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
12173 | } |