]>
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" | |
31 | ||
32 | #include "bgpd/bgpd.h" | |
33 | #include "bgpd/bgp_attr.h" | |
34 | #include "bgpd/bgp_aspath.h" | |
35 | #include "bgpd/bgp_community.h" | |
36 | #include "bgpd/bgp_debug.h" | |
e0701b79 | 37 | #include "bgpd/bgp_fsm.h" |
718e3744 | 38 | #include "bgpd/bgp_mplsvpn.h" |
39 | #include "bgpd/bgp_open.h" | |
40 | #include "bgpd/bgp_route.h" | |
41 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 42 | #include "bgpd/bgp_table.h" |
718e3744 | 43 | |
18a6dce6 | 44 | extern struct in_addr router_id_zebra; |
45 | ||
718e3744 | 46 | /* Utility function to get address family from current node. */ |
47 | afi_t | |
48 | bgp_node_afi (struct vty *vty) | |
49 | { | |
50 | if (vty->node == BGP_IPV6_NODE) | |
51 | return AFI_IP6; | |
52 | return AFI_IP; | |
53 | } | |
54 | ||
55 | /* Utility function to get subsequent address family from current | |
56 | node. */ | |
57 | safi_t | |
58 | bgp_node_safi (struct vty *vty) | |
59 | { | |
60 | if (vty->node == BGP_VPNV4_NODE) | |
61 | return SAFI_MPLS_VPN; | |
62 | if (vty->node == BGP_IPV4M_NODE) | |
63 | return SAFI_MULTICAST; | |
64 | return SAFI_UNICAST; | |
65 | } | |
66 | ||
67 | int | |
68 | peer_address_self_check (union sockunion *su) | |
69 | { | |
70 | struct interface *ifp = NULL; | |
71 | ||
72 | if (su->sa.sa_family == AF_INET) | |
73 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
74 | #ifdef HAVE_IPV6 | |
75 | else if (su->sa.sa_family == AF_INET6) | |
76 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); | |
77 | #endif /* HAVE IPV6 */ | |
78 | ||
79 | if (ifp) | |
80 | return 1; | |
81 | ||
82 | return 0; | |
83 | } | |
84 | ||
85 | /* Utility function for looking up peer from VTY. */ | |
86 | struct peer * | |
fd79ac91 | 87 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 88 | { |
89 | int ret; | |
90 | struct bgp *bgp; | |
91 | union sockunion su; | |
92 | struct peer *peer; | |
93 | ||
94 | bgp = vty->index; | |
95 | ||
96 | ret = str2sockunion (ip_str, &su); | |
97 | if (ret < 0) | |
98 | { | |
99 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); | |
100 | return NULL; | |
101 | } | |
102 | ||
103 | peer = peer_lookup (bgp, &su); | |
104 | if (! peer) | |
105 | { | |
106 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); | |
107 | return NULL; | |
108 | } | |
109 | return peer; | |
110 | } | |
111 | ||
112 | /* Utility function for looking up peer or peer group. */ | |
113 | struct peer * | |
fd79ac91 | 114 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 115 | { |
116 | int ret; | |
117 | struct bgp *bgp; | |
118 | union sockunion su; | |
119 | struct peer *peer; | |
120 | struct peer_group *group; | |
121 | ||
122 | bgp = vty->index; | |
123 | ||
124 | ret = str2sockunion (peer_str, &su); | |
125 | if (ret == 0) | |
126 | { | |
127 | peer = peer_lookup (bgp, &su); | |
128 | if (peer) | |
129 | return peer; | |
130 | } | |
131 | else | |
132 | { | |
133 | group = peer_group_lookup (bgp, peer_str); | |
134 | if (group) | |
135 | return group->conf; | |
136 | } | |
137 | ||
138 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
139 | VTY_NEWLINE); | |
140 | ||
141 | return NULL; | |
142 | } | |
143 | ||
144 | int | |
145 | bgp_vty_return (struct vty *vty, int ret) | |
146 | { | |
fd79ac91 | 147 | const char *str = NULL; |
718e3744 | 148 | |
149 | switch (ret) | |
150 | { | |
151 | case BGP_ERR_INVALID_VALUE: | |
152 | str = "Invalid value"; | |
153 | break; | |
154 | case BGP_ERR_INVALID_FLAG: | |
155 | str = "Invalid flag"; | |
156 | break; | |
157 | case BGP_ERR_PEER_INACTIVE: | |
158 | str = "Activate the neighbor for the address family first"; | |
159 | break; | |
160 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
161 | str = "Invalid command for a peer-group member"; | |
162 | break; | |
163 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
164 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
165 | break; | |
166 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
167 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
168 | break; | |
169 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
170 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
171 | break; | |
172 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
173 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
174 | break; | |
175 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
176 | str = "No activate for an individual peer-group member is invalid"; | |
177 | break; | |
178 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
179 | str = "Activate the peer-group for the address family first"; | |
180 | break; | |
181 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
182 | str = "Specify remote-as or peer-group remote AS first"; | |
183 | break; | |
184 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
185 | str = "Cannot change the peer-group. Deconfigure first"; | |
186 | break; | |
187 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
188 | str = "Cannot have different peer-group for the neighbor"; | |
189 | break; | |
190 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
191 | str = "Prefix/distribute list can not co-exist"; | |
192 | break; | |
193 | case BGP_ERR_NOT_INTERNAL_PEER: | |
194 | str = "Invalid command. Not an internal neighbor"; | |
195 | break; | |
196 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
197 | str = "Private AS cannot be removed for IBGP peers"; | |
198 | break; | |
199 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
200 | str = "Local-AS allowed only for EBGP peers"; | |
201 | break; | |
202 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
203 | str = "Cannot have local-as same as BGP AS number"; | |
204 | break; | |
205 | } | |
206 | if (str) | |
207 | { | |
208 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
209 | return CMD_WARNING; | |
210 | } | |
211 | return CMD_SUCCESS; | |
212 | } | |
213 | ||
214 | /* BGP global configuration. */ | |
215 | ||
216 | DEFUN (bgp_multiple_instance_func, | |
217 | bgp_multiple_instance_cmd, | |
218 | "bgp multiple-instance", | |
219 | BGP_STR | |
220 | "Enable bgp multiple instance\n") | |
221 | { | |
222 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
223 | return CMD_SUCCESS; | |
224 | } | |
225 | ||
226 | DEFUN (no_bgp_multiple_instance, | |
227 | no_bgp_multiple_instance_cmd, | |
228 | "no bgp multiple-instance", | |
229 | NO_STR | |
230 | BGP_STR | |
231 | "BGP multiple instance\n") | |
232 | { | |
233 | int ret; | |
234 | ||
235 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
236 | if (ret < 0) | |
237 | { | |
238 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
239 | return CMD_WARNING; | |
240 | } | |
241 | return CMD_SUCCESS; | |
242 | } | |
243 | ||
244 | DEFUN (bgp_config_type, | |
245 | bgp_config_type_cmd, | |
246 | "bgp config-type (cisco|zebra)", | |
247 | BGP_STR | |
248 | "Configuration type\n" | |
249 | "cisco\n" | |
250 | "zebra\n") | |
251 | { | |
252 | if (strncmp (argv[0], "c", 1) == 0) | |
253 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
254 | else | |
255 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
256 | ||
257 | return CMD_SUCCESS; | |
258 | } | |
259 | ||
260 | DEFUN (no_bgp_config_type, | |
261 | no_bgp_config_type_cmd, | |
262 | "no bgp config-type", | |
263 | NO_STR | |
264 | BGP_STR | |
265 | "Display configuration type\n") | |
266 | { | |
267 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
268 | return CMD_SUCCESS; | |
269 | } | |
270 | ||
271 | DEFUN (no_synchronization, | |
272 | no_synchronization_cmd, | |
273 | "no synchronization", | |
274 | NO_STR | |
275 | "Perform IGP synchronization\n") | |
276 | { | |
277 | return CMD_SUCCESS; | |
278 | } | |
279 | ||
280 | DEFUN (no_auto_summary, | |
281 | no_auto_summary_cmd, | |
282 | "no auto-summary", | |
283 | NO_STR | |
284 | "Enable automatic network number summarization\n") | |
285 | { | |
286 | return CMD_SUCCESS; | |
287 | } | |
288 | \f | |
289 | /* "router bgp" commands. */ | |
290 | DEFUN (router_bgp, | |
291 | router_bgp_cmd, | |
292 | "router bgp <1-65535>", | |
293 | ROUTER_STR | |
294 | BGP_STR | |
295 | AS_STR) | |
296 | { | |
297 | int ret; | |
298 | as_t as; | |
299 | struct bgp *bgp; | |
fd79ac91 | 300 | const char *name = NULL; |
718e3744 | 301 | |
302 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); | |
303 | ||
304 | if (argc == 2) | |
305 | name = argv[1]; | |
306 | ||
307 | ret = bgp_get (&bgp, &as, name); | |
308 | switch (ret) | |
309 | { | |
310 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
311 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
312 | VTY_NEWLINE); | |
313 | return CMD_WARNING; | |
314 | break; | |
315 | case BGP_ERR_AS_MISMATCH: | |
316 | vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE); | |
317 | return CMD_WARNING; | |
318 | break; | |
319 | case BGP_ERR_INSTANCE_MISMATCH: | |
320 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
321 | vty_out (vty, "BGP instance is already running; AS is %d%s", | |
322 | as, VTY_NEWLINE); | |
323 | return CMD_WARNING; | |
324 | break; | |
325 | } | |
326 | ||
327 | vty->node = BGP_NODE; | |
328 | vty->index = bgp; | |
329 | ||
330 | return CMD_SUCCESS; | |
331 | } | |
332 | ||
333 | ALIAS (router_bgp, | |
334 | router_bgp_view_cmd, | |
335 | "router bgp <1-65535> view WORD", | |
336 | ROUTER_STR | |
337 | BGP_STR | |
338 | AS_STR | |
339 | "BGP view\n" | |
340 | "view name\n") | |
341 | \f | |
342 | /* "no router bgp" commands. */ | |
343 | DEFUN (no_router_bgp, | |
344 | no_router_bgp_cmd, | |
345 | "no router bgp <1-65535>", | |
346 | NO_STR | |
347 | ROUTER_STR | |
348 | BGP_STR | |
349 | AS_STR) | |
350 | { | |
351 | as_t as; | |
352 | struct bgp *bgp; | |
fd79ac91 | 353 | const char *name = NULL; |
718e3744 | 354 | |
355 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535); | |
356 | ||
357 | if (argc == 2) | |
358 | name = argv[1]; | |
359 | ||
360 | /* Lookup bgp structure. */ | |
361 | bgp = bgp_lookup (as, name); | |
362 | if (! bgp) | |
363 | { | |
364 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
365 | return CMD_WARNING; | |
366 | } | |
367 | ||
368 | bgp_delete (bgp); | |
369 | ||
370 | return CMD_SUCCESS; | |
371 | } | |
372 | ||
373 | ALIAS (no_router_bgp, | |
374 | no_router_bgp_view_cmd, | |
375 | "no router bgp <1-65535> view WORD", | |
376 | NO_STR | |
377 | ROUTER_STR | |
378 | BGP_STR | |
379 | AS_STR | |
380 | "BGP view\n" | |
381 | "view name\n") | |
382 | \f | |
383 | /* BGP router-id. */ | |
384 | ||
385 | DEFUN (bgp_router_id, | |
386 | bgp_router_id_cmd, | |
387 | "bgp router-id A.B.C.D", | |
388 | BGP_STR | |
389 | "Override configured router identifier\n" | |
390 | "Manually configured router identifier\n") | |
391 | { | |
392 | int ret; | |
393 | struct in_addr id; | |
394 | struct bgp *bgp; | |
395 | ||
396 | bgp = vty->index; | |
397 | ||
398 | ret = inet_aton (argv[0], &id); | |
399 | if (! ret) | |
400 | { | |
401 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
402 | return CMD_WARNING; | |
403 | } | |
404 | ||
18a6dce6 | 405 | bgp->router_id_static = id; |
718e3744 | 406 | bgp_router_id_set (bgp, &id); |
407 | ||
408 | return CMD_SUCCESS; | |
409 | } | |
410 | ||
411 | DEFUN (no_bgp_router_id, | |
412 | no_bgp_router_id_cmd, | |
413 | "no bgp router-id", | |
414 | NO_STR | |
415 | BGP_STR | |
416 | "Override configured router identifier\n") | |
417 | { | |
418 | int ret; | |
419 | struct in_addr id; | |
420 | struct bgp *bgp; | |
421 | ||
422 | bgp = vty->index; | |
423 | ||
424 | if (argc == 1) | |
425 | { | |
426 | ret = inet_aton (argv[0], &id); | |
427 | if (! ret) | |
428 | { | |
429 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
430 | return CMD_WARNING; | |
431 | } | |
432 | ||
18a6dce6 | 433 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 434 | { |
435 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
436 | return CMD_WARNING; | |
437 | } | |
438 | } | |
439 | ||
18a6dce6 | 440 | bgp->router_id_static.s_addr = 0; |
441 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 442 | |
443 | return CMD_SUCCESS; | |
444 | } | |
445 | ||
446 | ALIAS (no_bgp_router_id, | |
447 | no_bgp_router_id_val_cmd, | |
448 | "no bgp router-id A.B.C.D", | |
449 | NO_STR | |
450 | BGP_STR | |
451 | "Override configured router identifier\n" | |
452 | "Manually configured router identifier\n") | |
453 | \f | |
454 | /* BGP Cluster ID. */ | |
455 | ||
456 | DEFUN (bgp_cluster_id, | |
457 | bgp_cluster_id_cmd, | |
458 | "bgp cluster-id A.B.C.D", | |
459 | BGP_STR | |
460 | "Configure Route-Reflector Cluster-id\n" | |
461 | "Route-Reflector Cluster-id in IP address format\n") | |
462 | { | |
463 | int ret; | |
464 | struct bgp *bgp; | |
465 | struct in_addr cluster; | |
466 | ||
467 | bgp = vty->index; | |
468 | ||
469 | ret = inet_aton (argv[0], &cluster); | |
470 | if (! ret) | |
471 | { | |
472 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
473 | return CMD_WARNING; | |
474 | } | |
475 | ||
476 | bgp_cluster_id_set (bgp, &cluster); | |
477 | ||
478 | return CMD_SUCCESS; | |
479 | } | |
480 | ||
481 | ALIAS (bgp_cluster_id, | |
482 | bgp_cluster_id32_cmd, | |
483 | "bgp cluster-id <1-4294967295>", | |
484 | BGP_STR | |
485 | "Configure Route-Reflector Cluster-id\n" | |
486 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
487 | ||
488 | DEFUN (no_bgp_cluster_id, | |
489 | no_bgp_cluster_id_cmd, | |
490 | "no bgp cluster-id", | |
491 | NO_STR | |
492 | BGP_STR | |
493 | "Configure Route-Reflector Cluster-id\n") | |
494 | { | |
495 | int ret; | |
496 | struct bgp *bgp; | |
497 | struct in_addr cluster; | |
498 | ||
499 | bgp = vty->index; | |
500 | ||
501 | if (argc == 1) | |
502 | { | |
503 | ret = inet_aton (argv[0], &cluster); | |
504 | if (! ret) | |
505 | { | |
506 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
507 | return CMD_WARNING; | |
508 | } | |
509 | } | |
510 | ||
511 | bgp_cluster_id_unset (bgp); | |
512 | ||
513 | return CMD_SUCCESS; | |
514 | } | |
515 | ||
516 | ALIAS (no_bgp_cluster_id, | |
517 | no_bgp_cluster_id_arg_cmd, | |
518 | "no bgp cluster-id A.B.C.D", | |
519 | NO_STR | |
520 | BGP_STR | |
521 | "Configure Route-Reflector Cluster-id\n" | |
522 | "Route-Reflector Cluster-id in IP address format\n") | |
523 | \f | |
524 | DEFUN (bgp_confederation_identifier, | |
525 | bgp_confederation_identifier_cmd, | |
526 | "bgp confederation identifier <1-65535>", | |
527 | "BGP specific commands\n" | |
528 | "AS confederation parameters\n" | |
529 | "AS number\n" | |
530 | "Set routing domain confederation AS\n") | |
531 | { | |
532 | struct bgp *bgp; | |
533 | as_t as; | |
534 | ||
535 | bgp = vty->index; | |
536 | ||
537 | VTY_GET_INTEGER ("AS", as, argv[0]); | |
538 | ||
539 | bgp_confederation_id_set (bgp, as); | |
540 | ||
541 | return CMD_SUCCESS; | |
542 | } | |
543 | ||
544 | DEFUN (no_bgp_confederation_identifier, | |
545 | no_bgp_confederation_identifier_cmd, | |
546 | "no bgp confederation identifier", | |
547 | NO_STR | |
548 | "BGP specific commands\n" | |
549 | "AS confederation parameters\n" | |
550 | "AS number\n") | |
551 | { | |
552 | struct bgp *bgp; | |
553 | as_t as; | |
554 | ||
555 | bgp = vty->index; | |
556 | ||
557 | if (argc == 1) | |
558 | VTY_GET_INTEGER ("AS", as, argv[0]); | |
559 | ||
560 | bgp_confederation_id_unset (bgp); | |
561 | ||
562 | return CMD_SUCCESS; | |
563 | } | |
564 | ||
565 | ALIAS (no_bgp_confederation_identifier, | |
566 | no_bgp_confederation_identifier_arg_cmd, | |
567 | "no bgp confederation identifier <1-65535>", | |
568 | NO_STR | |
569 | "BGP specific commands\n" | |
570 | "AS confederation parameters\n" | |
571 | "AS number\n" | |
572 | "Set routing domain confederation AS\n") | |
573 | \f | |
574 | DEFUN (bgp_confederation_peers, | |
575 | bgp_confederation_peers_cmd, | |
576 | "bgp confederation peers .<1-65535>", | |
577 | "BGP specific commands\n" | |
578 | "AS confederation parameters\n" | |
579 | "Peer ASs in BGP confederation\n" | |
580 | AS_STR) | |
581 | { | |
582 | struct bgp *bgp; | |
583 | as_t as; | |
584 | int i; | |
585 | ||
586 | bgp = vty->index; | |
587 | ||
588 | for (i = 0; i < argc; i++) | |
589 | { | |
590 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); | |
591 | ||
592 | if (bgp->as == as) | |
593 | { | |
594 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
595 | VTY_NEWLINE); | |
596 | continue; | |
597 | } | |
598 | ||
599 | bgp_confederation_peers_add (bgp, as); | |
600 | } | |
601 | return CMD_SUCCESS; | |
602 | } | |
603 | ||
604 | DEFUN (no_bgp_confederation_peers, | |
605 | no_bgp_confederation_peers_cmd, | |
606 | "no bgp confederation peers .<1-65535>", | |
607 | NO_STR | |
608 | "BGP specific commands\n" | |
609 | "AS confederation parameters\n" | |
610 | "Peer ASs in BGP confederation\n" | |
611 | AS_STR) | |
612 | { | |
613 | struct bgp *bgp; | |
614 | as_t as; | |
615 | int i; | |
616 | ||
617 | bgp = vty->index; | |
618 | ||
619 | for (i = 0; i < argc; i++) | |
620 | { | |
621 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535); | |
622 | ||
623 | bgp_confederation_peers_remove (bgp, as); | |
624 | } | |
625 | return CMD_SUCCESS; | |
626 | } | |
627 | \f | |
628 | /* BGP timers. */ | |
629 | ||
630 | DEFUN (bgp_timers, | |
631 | bgp_timers_cmd, | |
632 | "timers bgp <0-65535> <0-65535>", | |
633 | "Adjust routing timers\n" | |
634 | "BGP timers\n" | |
635 | "Keepalive interval\n" | |
636 | "Holdtime\n") | |
637 | { | |
638 | struct bgp *bgp; | |
639 | unsigned long keepalive = 0; | |
640 | unsigned long holdtime = 0; | |
641 | ||
642 | bgp = vty->index; | |
643 | ||
644 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
645 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
646 | ||
647 | /* Holdtime value check. */ | |
648 | if (holdtime < 3 && holdtime != 0) | |
649 | { | |
650 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
651 | VTY_NEWLINE); | |
652 | return CMD_WARNING; | |
653 | } | |
654 | ||
655 | bgp_timers_set (bgp, keepalive, holdtime); | |
656 | ||
657 | return CMD_SUCCESS; | |
658 | } | |
659 | ||
660 | DEFUN (no_bgp_timers, | |
661 | no_bgp_timers_cmd, | |
662 | "no timers bgp", | |
663 | NO_STR | |
664 | "Adjust routing timers\n" | |
665 | "BGP timers\n") | |
666 | { | |
667 | struct bgp *bgp; | |
668 | ||
669 | bgp = vty->index; | |
670 | bgp_timers_unset (bgp); | |
671 | ||
672 | return CMD_SUCCESS; | |
673 | } | |
674 | ||
675 | ALIAS (no_bgp_timers, | |
676 | no_bgp_timers_arg_cmd, | |
677 | "no timers bgp <0-65535> <0-65535>", | |
678 | NO_STR | |
679 | "Adjust routing timers\n" | |
680 | "BGP timers\n" | |
681 | "Keepalive interval\n" | |
682 | "Holdtime\n") | |
683 | \f | |
684 | DEFUN (bgp_client_to_client_reflection, | |
685 | bgp_client_to_client_reflection_cmd, | |
686 | "bgp client-to-client reflection", | |
687 | "BGP specific commands\n" | |
688 | "Configure client to client route reflection\n" | |
689 | "reflection of routes allowed\n") | |
690 | { | |
691 | struct bgp *bgp; | |
692 | ||
693 | bgp = vty->index; | |
694 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
695 | return CMD_SUCCESS; | |
696 | } | |
697 | ||
698 | DEFUN (no_bgp_client_to_client_reflection, | |
699 | no_bgp_client_to_client_reflection_cmd, | |
700 | "no bgp client-to-client reflection", | |
701 | NO_STR | |
702 | "BGP specific commands\n" | |
703 | "Configure client to client route reflection\n" | |
704 | "reflection of routes allowed\n") | |
705 | { | |
706 | struct bgp *bgp; | |
707 | ||
708 | bgp = vty->index; | |
709 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
710 | return CMD_SUCCESS; | |
711 | } | |
712 | ||
713 | /* "bgp always-compare-med" configuration. */ | |
714 | DEFUN (bgp_always_compare_med, | |
715 | bgp_always_compare_med_cmd, | |
716 | "bgp always-compare-med", | |
717 | "BGP specific commands\n" | |
718 | "Allow comparing MED from different neighbors\n") | |
719 | { | |
720 | struct bgp *bgp; | |
721 | ||
722 | bgp = vty->index; | |
723 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
724 | return CMD_SUCCESS; | |
725 | } | |
726 | ||
727 | DEFUN (no_bgp_always_compare_med, | |
728 | no_bgp_always_compare_med_cmd, | |
729 | "no bgp always-compare-med", | |
730 | NO_STR | |
731 | "BGP specific commands\n" | |
732 | "Allow comparing MED from different neighbors\n") | |
733 | { | |
734 | struct bgp *bgp; | |
735 | ||
736 | bgp = vty->index; | |
737 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
738 | return CMD_SUCCESS; | |
739 | } | |
740 | \f | |
741 | /* "bgp deterministic-med" configuration. */ | |
742 | DEFUN (bgp_deterministic_med, | |
743 | bgp_deterministic_med_cmd, | |
744 | "bgp deterministic-med", | |
745 | "BGP specific commands\n" | |
746 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
747 | { | |
748 | struct bgp *bgp; | |
749 | ||
750 | bgp = vty->index; | |
751 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
752 | return CMD_SUCCESS; | |
753 | } | |
754 | ||
755 | DEFUN (no_bgp_deterministic_med, | |
756 | no_bgp_deterministic_med_cmd, | |
757 | "no bgp deterministic-med", | |
758 | NO_STR | |
759 | "BGP specific commands\n" | |
760 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
761 | { | |
762 | struct bgp *bgp; | |
763 | ||
764 | bgp = vty->index; | |
765 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
766 | return CMD_SUCCESS; | |
767 | } | |
538621f2 | 768 | |
769 | /* "bgp graceful-restart" configuration. */ | |
770 | DEFUN (bgp_graceful_restart, | |
771 | bgp_graceful_restart_cmd, | |
772 | "bgp graceful-restart", | |
773 | "BGP specific commands\n" | |
774 | "Graceful restart capability parameters\n") | |
775 | { | |
776 | struct bgp *bgp; | |
777 | ||
778 | bgp = vty->index; | |
779 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
780 | return CMD_SUCCESS; | |
781 | } | |
782 | ||
783 | DEFUN (no_bgp_graceful_restart, | |
784 | no_bgp_graceful_restart_cmd, | |
785 | "no bgp graceful-restart", | |
786 | NO_STR | |
787 | "BGP specific commands\n" | |
788 | "Graceful restart capability parameters\n") | |
789 | { | |
790 | struct bgp *bgp; | |
791 | ||
792 | bgp = vty->index; | |
793 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
794 | return CMD_SUCCESS; | |
795 | } | |
796 | ||
718e3744 | 797 | /* "bgp fast-external-failover" configuration. */ |
798 | DEFUN (bgp_fast_external_failover, | |
799 | bgp_fast_external_failover_cmd, | |
800 | "bgp fast-external-failover", | |
801 | BGP_STR | |
802 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
803 | { | |
804 | struct bgp *bgp; | |
805 | ||
806 | bgp = vty->index; | |
807 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
808 | return CMD_SUCCESS; | |
809 | } | |
810 | ||
811 | DEFUN (no_bgp_fast_external_failover, | |
812 | no_bgp_fast_external_failover_cmd, | |
813 | "no bgp fast-external-failover", | |
814 | NO_STR | |
815 | BGP_STR | |
816 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
817 | { | |
818 | struct bgp *bgp; | |
819 | ||
820 | bgp = vty->index; | |
821 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
822 | return CMD_SUCCESS; | |
823 | } | |
824 | \f | |
825 | /* "bgp enforce-first-as" configuration. */ | |
826 | DEFUN (bgp_enforce_first_as, | |
827 | bgp_enforce_first_as_cmd, | |
828 | "bgp enforce-first-as", | |
829 | BGP_STR | |
830 | "Enforce the first AS for EBGP routes\n") | |
831 | { | |
832 | struct bgp *bgp; | |
833 | ||
834 | bgp = vty->index; | |
835 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
836 | return CMD_SUCCESS; | |
837 | } | |
838 | ||
839 | DEFUN (no_bgp_enforce_first_as, | |
840 | no_bgp_enforce_first_as_cmd, | |
841 | "no bgp enforce-first-as", | |
842 | NO_STR | |
843 | BGP_STR | |
844 | "Enforce the first AS for EBGP routes\n") | |
845 | { | |
846 | struct bgp *bgp; | |
847 | ||
848 | bgp = vty->index; | |
849 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
850 | return CMD_SUCCESS; | |
851 | } | |
852 | \f | |
853 | /* "bgp bestpath compare-routerid" configuration. */ | |
854 | DEFUN (bgp_bestpath_compare_router_id, | |
855 | bgp_bestpath_compare_router_id_cmd, | |
856 | "bgp bestpath compare-routerid", | |
857 | "BGP specific commands\n" | |
858 | "Change the default bestpath selection\n" | |
859 | "Compare router-id for identical EBGP paths\n") | |
860 | { | |
861 | struct bgp *bgp; | |
862 | ||
863 | bgp = vty->index; | |
864 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
865 | return CMD_SUCCESS; | |
866 | } | |
867 | ||
868 | DEFUN (no_bgp_bestpath_compare_router_id, | |
869 | no_bgp_bestpath_compare_router_id_cmd, | |
870 | "no bgp bestpath compare-routerid", | |
871 | NO_STR | |
872 | "BGP specific commands\n" | |
873 | "Change the default bestpath selection\n" | |
874 | "Compare router-id for identical EBGP paths\n") | |
875 | { | |
876 | struct bgp *bgp; | |
877 | ||
878 | bgp = vty->index; | |
879 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
880 | return CMD_SUCCESS; | |
881 | } | |
882 | \f | |
883 | /* "bgp bestpath as-path ignore" configuration. */ | |
884 | DEFUN (bgp_bestpath_aspath_ignore, | |
885 | bgp_bestpath_aspath_ignore_cmd, | |
886 | "bgp bestpath as-path ignore", | |
887 | "BGP specific commands\n" | |
888 | "Change the default bestpath selection\n" | |
889 | "AS-path attribute\n" | |
890 | "Ignore as-path length in selecting a route\n") | |
891 | { | |
892 | struct bgp *bgp; | |
893 | ||
894 | bgp = vty->index; | |
895 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
896 | return CMD_SUCCESS; | |
897 | } | |
898 | ||
899 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
900 | no_bgp_bestpath_aspath_ignore_cmd, | |
901 | "no bgp bestpath as-path ignore", | |
902 | NO_STR | |
903 | "BGP specific commands\n" | |
904 | "Change the default bestpath selection\n" | |
905 | "AS-path attribute\n" | |
906 | "Ignore as-path length in selecting a route\n") | |
907 | { | |
908 | struct bgp *bgp; | |
909 | ||
910 | bgp = vty->index; | |
911 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
912 | return CMD_SUCCESS; | |
913 | } | |
914 | \f | |
848973c7 | 915 | /* "bgp log-neighbor-changes" configuration. */ |
916 | DEFUN (bgp_log_neighbor_changes, | |
917 | bgp_log_neighbor_changes_cmd, | |
918 | "bgp log-neighbor-changes", | |
919 | "BGP specific commands\n" | |
920 | "Log neighbor up/down and reset reason\n") | |
921 | { | |
922 | struct bgp *bgp; | |
923 | ||
924 | bgp = vty->index; | |
925 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
926 | return CMD_SUCCESS; | |
927 | } | |
928 | ||
929 | DEFUN (no_bgp_log_neighbor_changes, | |
930 | no_bgp_log_neighbor_changes_cmd, | |
931 | "no bgp log-neighbor-changes", | |
932 | NO_STR | |
933 | "BGP specific commands\n" | |
934 | "Log neighbor up/down and reset reason\n") | |
935 | { | |
936 | struct bgp *bgp; | |
937 | ||
938 | bgp = vty->index; | |
939 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
940 | return CMD_SUCCESS; | |
941 | } | |
942 | \f | |
718e3744 | 943 | /* "bgp bestpath med" configuration. */ |
944 | DEFUN (bgp_bestpath_med, | |
945 | bgp_bestpath_med_cmd, | |
946 | "bgp bestpath med (confed|missing-as-worst)", | |
947 | "BGP specific commands\n" | |
948 | "Change the default bestpath selection\n" | |
949 | "MED attribute\n" | |
950 | "Compare MED among confederation paths\n" | |
951 | "Treat missing MED as the least preferred one\n") | |
952 | { | |
953 | struct bgp *bgp; | |
954 | ||
955 | bgp = vty->index; | |
956 | ||
957 | if (strncmp (argv[0], "confed", 1) == 0) | |
958 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
959 | else | |
960 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
961 | ||
962 | return CMD_SUCCESS; | |
963 | } | |
964 | ||
965 | DEFUN (bgp_bestpath_med2, | |
966 | bgp_bestpath_med2_cmd, | |
967 | "bgp bestpath med confed missing-as-worst", | |
968 | "BGP specific commands\n" | |
969 | "Change the default bestpath selection\n" | |
970 | "MED attribute\n" | |
971 | "Compare MED among confederation paths\n" | |
972 | "Treat missing MED as the least preferred one\n") | |
973 | { | |
974 | struct bgp *bgp; | |
975 | ||
976 | bgp = vty->index; | |
977 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
978 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
979 | return CMD_SUCCESS; | |
980 | } | |
981 | ||
982 | ALIAS (bgp_bestpath_med2, | |
983 | bgp_bestpath_med3_cmd, | |
984 | "bgp bestpath med missing-as-worst confed", | |
985 | "BGP specific commands\n" | |
986 | "Change the default bestpath selection\n" | |
987 | "MED attribute\n" | |
988 | "Treat missing MED as the least preferred one\n" | |
989 | "Compare MED among confederation paths\n") | |
990 | ||
991 | DEFUN (no_bgp_bestpath_med, | |
992 | no_bgp_bestpath_med_cmd, | |
993 | "no bgp bestpath med (confed|missing-as-worst)", | |
994 | NO_STR | |
995 | "BGP specific commands\n" | |
996 | "Change the default bestpath selection\n" | |
997 | "MED attribute\n" | |
998 | "Compare MED among confederation paths\n" | |
999 | "Treat missing MED as the least preferred one\n") | |
1000 | { | |
1001 | struct bgp *bgp; | |
1002 | ||
1003 | bgp = vty->index; | |
1004 | ||
1005 | if (strncmp (argv[0], "confed", 1) == 0) | |
1006 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1007 | else | |
1008 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1009 | ||
1010 | return CMD_SUCCESS; | |
1011 | } | |
1012 | ||
1013 | DEFUN (no_bgp_bestpath_med2, | |
1014 | no_bgp_bestpath_med2_cmd, | |
1015 | "no bgp bestpath med confed missing-as-worst", | |
1016 | NO_STR | |
1017 | "BGP specific commands\n" | |
1018 | "Change the default bestpath selection\n" | |
1019 | "MED attribute\n" | |
1020 | "Compare MED among confederation paths\n" | |
1021 | "Treat missing MED as the least preferred one\n") | |
1022 | { | |
1023 | struct bgp *bgp; | |
1024 | ||
1025 | bgp = vty->index; | |
1026 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1027 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1028 | return CMD_SUCCESS; | |
1029 | } | |
1030 | ||
1031 | ALIAS (no_bgp_bestpath_med2, | |
1032 | no_bgp_bestpath_med3_cmd, | |
1033 | "no bgp bestpath med missing-as-worst confed", | |
1034 | NO_STR | |
1035 | "BGP specific commands\n" | |
1036 | "Change the default bestpath selection\n" | |
1037 | "MED attribute\n" | |
1038 | "Treat missing MED as the least preferred one\n" | |
1039 | "Compare MED among confederation paths\n") | |
1040 | \f | |
1041 | /* "no bgp default ipv4-unicast". */ | |
1042 | DEFUN (no_bgp_default_ipv4_unicast, | |
1043 | no_bgp_default_ipv4_unicast_cmd, | |
1044 | "no bgp default ipv4-unicast", | |
1045 | NO_STR | |
1046 | "BGP specific commands\n" | |
1047 | "Configure BGP defaults\n" | |
1048 | "Activate ipv4-unicast for a peer by default\n") | |
1049 | { | |
1050 | struct bgp *bgp; | |
1051 | ||
1052 | bgp = vty->index; | |
1053 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1054 | return CMD_SUCCESS; | |
1055 | } | |
1056 | ||
1057 | DEFUN (bgp_default_ipv4_unicast, | |
1058 | bgp_default_ipv4_unicast_cmd, | |
1059 | "bgp default ipv4-unicast", | |
1060 | "BGP specific commands\n" | |
1061 | "Configure BGP defaults\n" | |
1062 | "Activate ipv4-unicast for a peer by default\n") | |
1063 | { | |
1064 | struct bgp *bgp; | |
1065 | ||
1066 | bgp = vty->index; | |
1067 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1068 | return CMD_SUCCESS; | |
1069 | } | |
1070 | \f | |
1071 | /* "bgp import-check" configuration. */ | |
1072 | DEFUN (bgp_network_import_check, | |
1073 | bgp_network_import_check_cmd, | |
1074 | "bgp network import-check", | |
1075 | "BGP specific commands\n" | |
1076 | "BGP network command\n" | |
1077 | "Check BGP network route exists in IGP\n") | |
1078 | { | |
1079 | struct bgp *bgp; | |
1080 | ||
1081 | bgp = vty->index; | |
1082 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
1083 | return CMD_SUCCESS; | |
1084 | } | |
1085 | ||
1086 | DEFUN (no_bgp_network_import_check, | |
1087 | no_bgp_network_import_check_cmd, | |
1088 | "no bgp network import-check", | |
1089 | NO_STR | |
1090 | "BGP specific commands\n" | |
1091 | "BGP network command\n" | |
1092 | "Check BGP network route exists in IGP\n") | |
1093 | { | |
1094 | struct bgp *bgp; | |
1095 | ||
1096 | bgp = vty->index; | |
1097 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
1098 | return CMD_SUCCESS; | |
1099 | } | |
1100 | \f | |
1101 | DEFUN (bgp_default_local_preference, | |
1102 | bgp_default_local_preference_cmd, | |
1103 | "bgp default local-preference <0-4294967295>", | |
1104 | "BGP specific commands\n" | |
1105 | "Configure BGP defaults\n" | |
1106 | "local preference (higher=more preferred)\n" | |
1107 | "Configure default local preference value\n") | |
1108 | { | |
1109 | struct bgp *bgp; | |
1110 | u_int32_t local_pref; | |
1111 | ||
1112 | bgp = vty->index; | |
1113 | ||
1114 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
1115 | ||
1116 | bgp_default_local_preference_set (bgp, local_pref); | |
1117 | ||
1118 | return CMD_SUCCESS; | |
1119 | } | |
1120 | ||
1121 | DEFUN (no_bgp_default_local_preference, | |
1122 | no_bgp_default_local_preference_cmd, | |
1123 | "no bgp default local-preference", | |
1124 | NO_STR | |
1125 | "BGP specific commands\n" | |
1126 | "Configure BGP defaults\n" | |
1127 | "local preference (higher=more preferred)\n") | |
1128 | { | |
1129 | struct bgp *bgp; | |
1130 | ||
1131 | bgp = vty->index; | |
1132 | bgp_default_local_preference_unset (bgp); | |
1133 | return CMD_SUCCESS; | |
1134 | } | |
1135 | ||
1136 | ALIAS (no_bgp_default_local_preference, | |
1137 | no_bgp_default_local_preference_val_cmd, | |
1138 | "no bgp default local-preference <0-4294967295>", | |
1139 | NO_STR | |
1140 | "BGP specific commands\n" | |
1141 | "Configure BGP defaults\n" | |
1142 | "local preference (higher=more preferred)\n" | |
1143 | "Configure default local preference value\n") | |
1144 | \f | |
1145 | static int | |
fd79ac91 | 1146 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
1147 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 1148 | { |
1149 | int ret; | |
1150 | struct bgp *bgp; | |
1151 | as_t as; | |
1152 | union sockunion su; | |
1153 | ||
1154 | bgp = vty->index; | |
1155 | ||
1156 | /* Get AS number. */ | |
1157 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535); | |
1158 | ||
1159 | /* If peer is peer group, call proper function. */ | |
1160 | ret = str2sockunion (peer_str, &su); | |
1161 | if (ret < 0) | |
1162 | { | |
1163 | ret = peer_group_remote_as (bgp, peer_str, &as); | |
1164 | if (ret < 0) | |
1165 | { | |
1166 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1167 | return CMD_WARNING; | |
1168 | } | |
1169 | return CMD_SUCCESS; | |
1170 | } | |
1171 | ||
1172 | if (peer_address_self_check (&su)) | |
1173 | { | |
1174 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1175 | VTY_NEWLINE); | |
1176 | return CMD_WARNING; | |
1177 | } | |
1178 | ||
1179 | ret = peer_remote_as (bgp, &su, &as, afi, safi); | |
1180 | ||
1181 | /* This peer belongs to peer group. */ | |
1182 | switch (ret) | |
1183 | { | |
1184 | case BGP_ERR_PEER_GROUP_MEMBER: | |
1185 | vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); | |
1186 | return CMD_WARNING; | |
1187 | break; | |
1188 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: | |
1189 | vty_out (vty, "%% The AS# can not be changed from %d to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); | |
1190 | return CMD_WARNING; | |
1191 | break; | |
1192 | } | |
1193 | return bgp_vty_return (vty, ret); | |
1194 | } | |
1195 | ||
1196 | DEFUN (neighbor_remote_as, | |
1197 | neighbor_remote_as_cmd, | |
1198 | NEIGHBOR_CMD2 "remote-as <1-65535>", | |
1199 | NEIGHBOR_STR | |
1200 | NEIGHBOR_ADDR_STR2 | |
1201 | "Specify a BGP neighbor\n" | |
1202 | AS_STR) | |
1203 | { | |
1204 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
1205 | } | |
1206 | \f | |
1207 | DEFUN (neighbor_peer_group, | |
1208 | neighbor_peer_group_cmd, | |
1209 | "neighbor WORD peer-group", | |
1210 | NEIGHBOR_STR | |
1211 | "Neighbor tag\n" | |
1212 | "Configure peer-group\n") | |
1213 | { | |
1214 | struct bgp *bgp; | |
1215 | struct peer_group *group; | |
1216 | ||
1217 | bgp = vty->index; | |
1218 | ||
1219 | group = peer_group_get (bgp, argv[0]); | |
1220 | if (! group) | |
1221 | return CMD_WARNING; | |
1222 | ||
1223 | return CMD_SUCCESS; | |
1224 | } | |
1225 | ||
1226 | DEFUN (no_neighbor, | |
1227 | no_neighbor_cmd, | |
1228 | NO_NEIGHBOR_CMD2, | |
1229 | NO_STR | |
1230 | NEIGHBOR_STR | |
1231 | NEIGHBOR_ADDR_STR2) | |
1232 | { | |
1233 | int ret; | |
1234 | union sockunion su; | |
1235 | struct peer_group *group; | |
1236 | struct peer *peer; | |
1237 | ||
1238 | ret = str2sockunion (argv[0], &su); | |
1239 | if (ret < 0) | |
1240 | { | |
1241 | group = peer_group_lookup (vty->index, argv[0]); | |
1242 | if (group) | |
1243 | peer_group_delete (group); | |
1244 | else | |
1245 | { | |
1246 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1247 | return CMD_WARNING; | |
1248 | } | |
1249 | } | |
1250 | else | |
1251 | { | |
1252 | peer = peer_lookup (vty->index, &su); | |
1253 | if (peer) | |
1254 | peer_delete (peer); | |
1255 | } | |
1256 | ||
1257 | return CMD_SUCCESS; | |
1258 | } | |
1259 | ||
1260 | ALIAS (no_neighbor, | |
1261 | no_neighbor_remote_as_cmd, | |
1262 | NO_NEIGHBOR_CMD "remote-as <1-65535>", | |
1263 | NO_STR | |
1264 | NEIGHBOR_STR | |
1265 | NEIGHBOR_ADDR_STR | |
1266 | "Specify a BGP neighbor\n" | |
1267 | AS_STR) | |
1268 | ||
1269 | DEFUN (no_neighbor_peer_group, | |
1270 | no_neighbor_peer_group_cmd, | |
1271 | "no neighbor WORD peer-group", | |
1272 | NO_STR | |
1273 | NEIGHBOR_STR | |
1274 | "Neighbor tag\n" | |
1275 | "Configure peer-group\n") | |
1276 | { | |
1277 | struct peer_group *group; | |
1278 | ||
1279 | group = peer_group_lookup (vty->index, argv[0]); | |
1280 | if (group) | |
1281 | peer_group_delete (group); | |
1282 | else | |
1283 | { | |
1284 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1285 | return CMD_WARNING; | |
1286 | } | |
1287 | return CMD_SUCCESS; | |
1288 | } | |
1289 | ||
1290 | DEFUN (no_neighbor_peer_group_remote_as, | |
1291 | no_neighbor_peer_group_remote_as_cmd, | |
1292 | "no neighbor WORD remote-as <1-65535>", | |
1293 | NO_STR | |
1294 | NEIGHBOR_STR | |
1295 | "Neighbor tag\n" | |
1296 | "Specify a BGP neighbor\n" | |
1297 | AS_STR) | |
1298 | { | |
1299 | struct peer_group *group; | |
1300 | ||
1301 | group = peer_group_lookup (vty->index, argv[0]); | |
1302 | if (group) | |
1303 | peer_group_remote_as_delete (group); | |
1304 | else | |
1305 | { | |
1306 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1307 | return CMD_WARNING; | |
1308 | } | |
1309 | return CMD_SUCCESS; | |
1310 | } | |
1311 | \f | |
1312 | DEFUN (neighbor_local_as, | |
1313 | neighbor_local_as_cmd, | |
1314 | NEIGHBOR_CMD2 "local-as <1-65535>", | |
1315 | NEIGHBOR_STR | |
1316 | NEIGHBOR_ADDR_STR2 | |
1317 | "Specify a local-as number\n" | |
1318 | "AS number used as local AS\n") | |
1319 | { | |
1320 | struct peer *peer; | |
1321 | int ret; | |
1322 | ||
1323 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1324 | if (! peer) | |
1325 | return CMD_WARNING; | |
1326 | ||
1327 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); | |
1328 | return bgp_vty_return (vty, ret); | |
1329 | } | |
1330 | ||
1331 | DEFUN (neighbor_local_as_no_prepend, | |
1332 | neighbor_local_as_no_prepend_cmd, | |
1333 | NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", | |
1334 | NEIGHBOR_STR | |
1335 | NEIGHBOR_ADDR_STR2 | |
1336 | "Specify a local-as number\n" | |
1337 | "AS number used as local AS\n" | |
1338 | "Do not prepend local-as to updates from ebgp peers\n") | |
1339 | { | |
1340 | struct peer *peer; | |
1341 | int ret; | |
1342 | ||
1343 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1344 | if (! peer) | |
1345 | return CMD_WARNING; | |
1346 | ||
1347 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); | |
1348 | return bgp_vty_return (vty, ret); | |
1349 | } | |
1350 | ||
1351 | DEFUN (no_neighbor_local_as, | |
1352 | no_neighbor_local_as_cmd, | |
1353 | NO_NEIGHBOR_CMD2 "local-as", | |
1354 | NO_STR | |
1355 | NEIGHBOR_STR | |
1356 | NEIGHBOR_ADDR_STR2 | |
1357 | "Specify a local-as number\n") | |
1358 | { | |
1359 | struct peer *peer; | |
1360 | int ret; | |
1361 | ||
1362 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1363 | if (! peer) | |
1364 | return CMD_WARNING; | |
1365 | ||
1366 | ret = peer_local_as_unset (peer); | |
1367 | return bgp_vty_return (vty, ret); | |
1368 | } | |
1369 | ||
1370 | ALIAS (no_neighbor_local_as, | |
1371 | no_neighbor_local_as_val_cmd, | |
1372 | NO_NEIGHBOR_CMD2 "local-as <1-65535>", | |
1373 | NO_STR | |
1374 | NEIGHBOR_STR | |
1375 | NEIGHBOR_ADDR_STR2 | |
1376 | "Specify a local-as number\n" | |
1377 | "AS number used as local AS\n") | |
1378 | ||
1379 | ALIAS (no_neighbor_local_as, | |
1380 | no_neighbor_local_as_val2_cmd, | |
1381 | NO_NEIGHBOR_CMD2 "local-as <1-65535> no-prepend", | |
1382 | NO_STR | |
1383 | NEIGHBOR_STR | |
1384 | NEIGHBOR_ADDR_STR2 | |
1385 | "Specify a local-as number\n" | |
1386 | "AS number used as local AS\n" | |
1387 | "Do not prepend local-as to updates from ebgp peers\n") | |
1388 | \f | |
1389 | DEFUN (neighbor_activate, | |
1390 | neighbor_activate_cmd, | |
1391 | NEIGHBOR_CMD2 "activate", | |
1392 | NEIGHBOR_STR | |
1393 | NEIGHBOR_ADDR_STR2 | |
1394 | "Enable the Address Family for this Neighbor\n") | |
1395 | { | |
1396 | struct peer *peer; | |
1397 | ||
1398 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1399 | if (! peer) | |
1400 | return CMD_WARNING; | |
1401 | ||
1402 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
1403 | ||
1404 | return CMD_SUCCESS; | |
1405 | } | |
1406 | ||
1407 | DEFUN (no_neighbor_activate, | |
1408 | no_neighbor_activate_cmd, | |
1409 | NO_NEIGHBOR_CMD2 "activate", | |
1410 | NO_STR | |
1411 | NEIGHBOR_STR | |
1412 | NEIGHBOR_ADDR_STR2 | |
1413 | "Enable the Address Family for this Neighbor\n") | |
1414 | { | |
1415 | int ret; | |
1416 | struct peer *peer; | |
1417 | ||
1418 | /* Lookup peer. */ | |
1419 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1420 | if (! peer) | |
1421 | return CMD_WARNING; | |
1422 | ||
1423 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
1424 | ||
1425 | return bgp_vty_return (vty, ret); | |
1426 | } | |
1427 | \f | |
1428 | DEFUN (neighbor_set_peer_group, | |
1429 | neighbor_set_peer_group_cmd, | |
1430 | NEIGHBOR_CMD "peer-group WORD", | |
1431 | NEIGHBOR_STR | |
1432 | NEIGHBOR_ADDR_STR | |
1433 | "Member of the peer-group\n" | |
1434 | "peer-group name\n") | |
1435 | { | |
1436 | int ret; | |
1437 | as_t as; | |
1438 | union sockunion su; | |
1439 | struct bgp *bgp; | |
1440 | struct peer_group *group; | |
1441 | ||
1442 | bgp = vty->index; | |
1443 | ||
1444 | ret = str2sockunion (argv[0], &su); | |
1445 | if (ret < 0) | |
1446 | { | |
1447 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); | |
1448 | return CMD_WARNING; | |
1449 | } | |
1450 | ||
1451 | group = peer_group_lookup (bgp, argv[1]); | |
1452 | if (! group) | |
1453 | { | |
1454 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
1455 | return CMD_WARNING; | |
1456 | } | |
1457 | ||
1458 | if (peer_address_self_check (&su)) | |
1459 | { | |
1460 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1461 | VTY_NEWLINE); | |
1462 | return CMD_WARNING; | |
1463 | } | |
1464 | ||
1465 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), | |
1466 | bgp_node_safi (vty), &as); | |
1467 | ||
1468 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
1469 | { | |
1470 | vty_out (vty, "%% Peer with AS %d cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE); | |
1471 | return CMD_WARNING; | |
1472 | } | |
1473 | ||
1474 | return bgp_vty_return (vty, ret); | |
1475 | } | |
1476 | ||
1477 | DEFUN (no_neighbor_set_peer_group, | |
1478 | no_neighbor_set_peer_group_cmd, | |
1479 | NO_NEIGHBOR_CMD "peer-group WORD", | |
1480 | NO_STR | |
1481 | NEIGHBOR_STR | |
1482 | NEIGHBOR_ADDR_STR | |
1483 | "Member of the peer-group\n" | |
1484 | "peer-group name\n") | |
1485 | { | |
1486 | int ret; | |
1487 | struct bgp *bgp; | |
1488 | struct peer *peer; | |
1489 | struct peer_group *group; | |
1490 | ||
1491 | bgp = vty->index; | |
1492 | ||
1493 | peer = peer_lookup_vty (vty, argv[0]); | |
1494 | if (! peer) | |
1495 | return CMD_WARNING; | |
1496 | ||
1497 | group = peer_group_lookup (bgp, argv[1]); | |
1498 | if (! group) | |
1499 | { | |
1500 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
1501 | return CMD_WARNING; | |
1502 | } | |
1503 | ||
1504 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
1505 | bgp_node_safi (vty)); | |
1506 | ||
1507 | return bgp_vty_return (vty, ret); | |
1508 | } | |
1509 | \f | |
1510 | int | |
fd79ac91 | 1511 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
1512 | u_int16_t flag, int set) | |
718e3744 | 1513 | { |
1514 | int ret; | |
1515 | struct peer *peer; | |
1516 | ||
1517 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
1518 | if (! peer) | |
1519 | return CMD_WARNING; | |
1520 | ||
1521 | if (set) | |
1522 | ret = peer_flag_set (peer, flag); | |
1523 | else | |
1524 | ret = peer_flag_unset (peer, flag); | |
1525 | ||
1526 | return bgp_vty_return (vty, ret); | |
1527 | } | |
1528 | ||
1529 | int | |
fd79ac91 | 1530 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 1531 | { |
1532 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
1533 | } | |
1534 | ||
1535 | int | |
fd79ac91 | 1536 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 1537 | { |
1538 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
1539 | } | |
1540 | ||
1541 | /* neighbor passive. */ | |
1542 | DEFUN (neighbor_passive, | |
1543 | neighbor_passive_cmd, | |
1544 | NEIGHBOR_CMD2 "passive", | |
1545 | NEIGHBOR_STR | |
1546 | NEIGHBOR_ADDR_STR2 | |
1547 | "Don't send open messages to this neighbor\n") | |
1548 | { | |
1549 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
1550 | } | |
1551 | ||
1552 | DEFUN (no_neighbor_passive, | |
1553 | no_neighbor_passive_cmd, | |
1554 | NO_NEIGHBOR_CMD2 "passive", | |
1555 | NO_STR | |
1556 | NEIGHBOR_STR | |
1557 | NEIGHBOR_ADDR_STR2 | |
1558 | "Don't send open messages to this neighbor\n") | |
1559 | { | |
1560 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
1561 | } | |
1562 | \f | |
1563 | /* neighbor shutdown. */ | |
1564 | DEFUN (neighbor_shutdown, | |
1565 | neighbor_shutdown_cmd, | |
1566 | NEIGHBOR_CMD2 "shutdown", | |
1567 | NEIGHBOR_STR | |
1568 | NEIGHBOR_ADDR_STR2 | |
1569 | "Administratively shut down this neighbor\n") | |
1570 | { | |
1571 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
1572 | } | |
1573 | ||
1574 | DEFUN (no_neighbor_shutdown, | |
1575 | no_neighbor_shutdown_cmd, | |
1576 | NO_NEIGHBOR_CMD2 "shutdown", | |
1577 | NO_STR | |
1578 | NEIGHBOR_STR | |
1579 | NEIGHBOR_ADDR_STR2 | |
1580 | "Administratively shut down this neighbor\n") | |
1581 | { | |
1582 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
1583 | } | |
1584 | \f | |
1585 | /* neighbor capability route-refresh. */ | |
1586 | DEFUN (neighbor_capability_route_refresh, | |
1587 | neighbor_capability_route_refresh_cmd, | |
1588 | NEIGHBOR_CMD2 "capability route-refresh", | |
1589 | NEIGHBOR_STR | |
1590 | NEIGHBOR_ADDR_STR2 | |
1591 | "Advertise capability to the peer\n" | |
1592 | "Advertise route-refresh capability to this neighbor\n") | |
1593 | { | |
1594 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP); | |
1595 | } | |
1596 | ||
1597 | DEFUN (no_neighbor_capability_route_refresh, | |
1598 | no_neighbor_capability_route_refresh_cmd, | |
1599 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
1600 | NO_STR | |
1601 | NEIGHBOR_STR | |
1602 | NEIGHBOR_ADDR_STR2 | |
1603 | "Advertise capability to the peer\n" | |
1604 | "Advertise route-refresh capability to this neighbor\n") | |
1605 | { | |
1606 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_NO_ROUTE_REFRESH_CAP); | |
1607 | } | |
1608 | \f | |
1609 | /* neighbor capability dynamic. */ | |
1610 | DEFUN (neighbor_capability_dynamic, | |
1611 | neighbor_capability_dynamic_cmd, | |
1612 | NEIGHBOR_CMD2 "capability dynamic", | |
1613 | NEIGHBOR_STR | |
1614 | NEIGHBOR_ADDR_STR2 | |
1615 | "Advertise capability to the peer\n" | |
1616 | "Advertise dynamic capability to this neighbor\n") | |
1617 | { | |
1618 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
1619 | } | |
1620 | ||
1621 | DEFUN (no_neighbor_capability_dynamic, | |
1622 | no_neighbor_capability_dynamic_cmd, | |
1623 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
1624 | NO_STR | |
1625 | NEIGHBOR_STR | |
1626 | NEIGHBOR_ADDR_STR2 | |
1627 | "Advertise capability to the peer\n" | |
1628 | "Advertise dynamic capability to this neighbor\n") | |
1629 | { | |
1630 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
1631 | } | |
1632 | \f | |
1633 | /* neighbor dont-capability-negotiate */ | |
1634 | DEFUN (neighbor_dont_capability_negotiate, | |
1635 | neighbor_dont_capability_negotiate_cmd, | |
1636 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
1637 | NEIGHBOR_STR | |
1638 | NEIGHBOR_ADDR_STR2 | |
1639 | "Do not perform capability negotiation\n") | |
1640 | { | |
1641 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
1642 | } | |
1643 | ||
1644 | DEFUN (no_neighbor_dont_capability_negotiate, | |
1645 | no_neighbor_dont_capability_negotiate_cmd, | |
1646 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
1647 | NO_STR | |
1648 | NEIGHBOR_STR | |
1649 | NEIGHBOR_ADDR_STR2 | |
1650 | "Do not perform capability negotiation\n") | |
1651 | { | |
1652 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
1653 | } | |
1654 | \f | |
1655 | int | |
fd79ac91 | 1656 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 1657 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 1658 | { |
1659 | int ret; | |
1660 | struct peer *peer; | |
1661 | ||
1662 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
1663 | if (! peer) | |
1664 | return CMD_WARNING; | |
1665 | ||
1666 | if (set) | |
1667 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
1668 | else | |
1669 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
1670 | ||
1671 | return bgp_vty_return (vty, ret); | |
1672 | } | |
1673 | ||
1674 | int | |
fd79ac91 | 1675 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 1676 | safi_t safi, u_int32_t flag) |
718e3744 | 1677 | { |
1678 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
1679 | } | |
1680 | ||
1681 | int | |
fd79ac91 | 1682 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 1683 | safi_t safi, u_int32_t flag) |
718e3744 | 1684 | { |
1685 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
1686 | } | |
1687 | \f | |
1688 | /* neighbor capability orf prefix-list. */ | |
1689 | DEFUN (neighbor_capability_orf_prefix, | |
1690 | neighbor_capability_orf_prefix_cmd, | |
1691 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
1692 | NEIGHBOR_STR | |
1693 | NEIGHBOR_ADDR_STR2 | |
1694 | "Advertise capability to the peer\n" | |
1695 | "Advertise ORF capability to the peer\n" | |
1696 | "Advertise prefixlist ORF capability to this neighbor\n" | |
1697 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
1698 | "Capability to RECEIVE the ORF from this neighbor\n" | |
1699 | "Capability to SEND the ORF to this neighbor\n") | |
1700 | { | |
1701 | u_int16_t flag = 0; | |
1702 | ||
1703 | if (strncmp (argv[1], "s", 1) == 0) | |
1704 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
1705 | else if (strncmp (argv[1], "r", 1) == 0) | |
1706 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
1707 | else if (strncmp (argv[1], "b", 1) == 0) | |
1708 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
1709 | else | |
1710 | return CMD_WARNING; | |
1711 | ||
1712 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1713 | bgp_node_safi (vty), flag); | |
1714 | } | |
1715 | ||
1716 | DEFUN (no_neighbor_capability_orf_prefix, | |
1717 | no_neighbor_capability_orf_prefix_cmd, | |
1718 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
1719 | NO_STR | |
1720 | NEIGHBOR_STR | |
1721 | NEIGHBOR_ADDR_STR2 | |
1722 | "Advertise capability to the peer\n" | |
1723 | "Advertise ORF capability to the peer\n" | |
1724 | "Advertise prefixlist ORF capability to this neighbor\n" | |
1725 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
1726 | "Capability to RECEIVE the ORF from this neighbor\n" | |
1727 | "Capability to SEND the ORF to this neighbor\n") | |
1728 | { | |
1729 | u_int16_t flag = 0; | |
1730 | ||
1731 | if (strncmp (argv[1], "s", 1) == 0) | |
1732 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
1733 | else if (strncmp (argv[1], "r", 1) == 0) | |
1734 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
1735 | else if (strncmp (argv[1], "b", 1) == 0) | |
1736 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
1737 | else | |
1738 | return CMD_WARNING; | |
1739 | ||
1740 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1741 | bgp_node_safi (vty), flag); | |
1742 | } | |
1743 | \f | |
1744 | /* neighbor next-hop-self. */ | |
1745 | DEFUN (neighbor_nexthop_self, | |
1746 | neighbor_nexthop_self_cmd, | |
1747 | NEIGHBOR_CMD2 "next-hop-self", | |
1748 | NEIGHBOR_STR | |
1749 | NEIGHBOR_ADDR_STR2 | |
1750 | "Disable the next hop calculation for this neighbor\n") | |
1751 | { | |
1752 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1753 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
1754 | } | |
1755 | ||
1756 | DEFUN (no_neighbor_nexthop_self, | |
1757 | no_neighbor_nexthop_self_cmd, | |
1758 | NO_NEIGHBOR_CMD2 "next-hop-self", | |
1759 | NO_STR | |
1760 | NEIGHBOR_STR | |
1761 | NEIGHBOR_ADDR_STR2 | |
1762 | "Disable the next hop calculation for this neighbor\n") | |
1763 | { | |
1764 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1765 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
1766 | } | |
1767 | \f | |
1768 | /* neighbor remove-private-AS. */ | |
1769 | DEFUN (neighbor_remove_private_as, | |
1770 | neighbor_remove_private_as_cmd, | |
1771 | NEIGHBOR_CMD2 "remove-private-AS", | |
1772 | NEIGHBOR_STR | |
1773 | NEIGHBOR_ADDR_STR2 | |
1774 | "Remove private AS number from outbound updates\n") | |
1775 | { | |
1776 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1777 | bgp_node_safi (vty), | |
1778 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
1779 | } | |
1780 | ||
1781 | DEFUN (no_neighbor_remove_private_as, | |
1782 | no_neighbor_remove_private_as_cmd, | |
1783 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
1784 | NO_STR | |
1785 | NEIGHBOR_STR | |
1786 | NEIGHBOR_ADDR_STR2 | |
1787 | "Remove private AS number from outbound updates\n") | |
1788 | { | |
1789 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1790 | bgp_node_safi (vty), | |
1791 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
1792 | } | |
1793 | \f | |
1794 | /* neighbor send-community. */ | |
1795 | DEFUN (neighbor_send_community, | |
1796 | neighbor_send_community_cmd, | |
1797 | NEIGHBOR_CMD2 "send-community", | |
1798 | NEIGHBOR_STR | |
1799 | NEIGHBOR_ADDR_STR2 | |
1800 | "Send Community attribute to this neighbor\n") | |
1801 | { | |
1802 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1803 | bgp_node_safi (vty), | |
1804 | PEER_FLAG_SEND_COMMUNITY); | |
1805 | } | |
1806 | ||
1807 | DEFUN (no_neighbor_send_community, | |
1808 | no_neighbor_send_community_cmd, | |
1809 | NO_NEIGHBOR_CMD2 "send-community", | |
1810 | NO_STR | |
1811 | NEIGHBOR_STR | |
1812 | NEIGHBOR_ADDR_STR2 | |
1813 | "Send Community attribute to this neighbor\n") | |
1814 | { | |
1815 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1816 | bgp_node_safi (vty), | |
1817 | PEER_FLAG_SEND_COMMUNITY); | |
1818 | } | |
1819 | \f | |
1820 | /* neighbor send-community extended. */ | |
1821 | DEFUN (neighbor_send_community_type, | |
1822 | neighbor_send_community_type_cmd, | |
1823 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
1824 | NEIGHBOR_STR | |
1825 | NEIGHBOR_ADDR_STR2 | |
1826 | "Send Community attribute to this neighbor\n" | |
1827 | "Send Standard and Extended Community attributes\n" | |
1828 | "Send Extended Community attributes\n" | |
1829 | "Send Standard Community attributes\n") | |
1830 | { | |
1831 | if (strncmp (argv[1], "s", 1) == 0) | |
1832 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1833 | bgp_node_safi (vty), | |
1834 | PEER_FLAG_SEND_COMMUNITY); | |
1835 | if (strncmp (argv[1], "e", 1) == 0) | |
1836 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1837 | bgp_node_safi (vty), | |
1838 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
1839 | ||
1840 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1841 | bgp_node_safi (vty), | |
1842 | (PEER_FLAG_SEND_COMMUNITY| | |
1843 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
1844 | } | |
1845 | ||
1846 | DEFUN (no_neighbor_send_community_type, | |
1847 | no_neighbor_send_community_type_cmd, | |
1848 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
1849 | NO_STR | |
1850 | NEIGHBOR_STR | |
1851 | NEIGHBOR_ADDR_STR2 | |
1852 | "Send Community attribute to this neighbor\n" | |
1853 | "Send Standard and Extended Community attributes\n" | |
1854 | "Send Extended Community attributes\n" | |
1855 | "Send Standard Community attributes\n") | |
1856 | { | |
1857 | if (strncmp (argv[1], "s", 1) == 0) | |
1858 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1859 | bgp_node_safi (vty), | |
1860 | PEER_FLAG_SEND_COMMUNITY); | |
1861 | if (strncmp (argv[1], "e", 1) == 0) | |
1862 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1863 | bgp_node_safi (vty), | |
1864 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
1865 | ||
1866 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1867 | bgp_node_safi (vty), | |
1868 | (PEER_FLAG_SEND_COMMUNITY | | |
1869 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
1870 | } | |
1871 | \f | |
1872 | /* neighbor soft-reconfig. */ | |
1873 | DEFUN (neighbor_soft_reconfiguration, | |
1874 | neighbor_soft_reconfiguration_cmd, | |
1875 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
1876 | NEIGHBOR_STR | |
1877 | NEIGHBOR_ADDR_STR2 | |
1878 | "Per neighbor soft reconfiguration\n" | |
1879 | "Allow inbound soft reconfiguration for this neighbor\n") | |
1880 | { | |
1881 | return peer_af_flag_set_vty (vty, argv[0], | |
1882 | bgp_node_afi (vty), bgp_node_safi (vty), | |
1883 | PEER_FLAG_SOFT_RECONFIG); | |
1884 | } | |
1885 | ||
1886 | DEFUN (no_neighbor_soft_reconfiguration, | |
1887 | no_neighbor_soft_reconfiguration_cmd, | |
1888 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
1889 | NO_STR | |
1890 | NEIGHBOR_STR | |
1891 | NEIGHBOR_ADDR_STR2 | |
1892 | "Per neighbor soft reconfiguration\n" | |
1893 | "Allow inbound soft reconfiguration for this neighbor\n") | |
1894 | { | |
1895 | return peer_af_flag_unset_vty (vty, argv[0], | |
1896 | bgp_node_afi (vty), bgp_node_safi (vty), | |
1897 | PEER_FLAG_SOFT_RECONFIG); | |
1898 | } | |
1899 | \f | |
1900 | DEFUN (neighbor_route_reflector_client, | |
1901 | neighbor_route_reflector_client_cmd, | |
1902 | NEIGHBOR_CMD2 "route-reflector-client", | |
1903 | NEIGHBOR_STR | |
1904 | NEIGHBOR_ADDR_STR2 | |
1905 | "Configure a neighbor as Route Reflector client\n") | |
1906 | { | |
1907 | struct peer *peer; | |
1908 | ||
1909 | ||
1910 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1911 | if (! peer) | |
1912 | return CMD_WARNING; | |
1913 | ||
1914 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1915 | bgp_node_safi (vty), | |
1916 | PEER_FLAG_REFLECTOR_CLIENT); | |
1917 | } | |
1918 | ||
1919 | DEFUN (no_neighbor_route_reflector_client, | |
1920 | no_neighbor_route_reflector_client_cmd, | |
1921 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
1922 | NO_STR | |
1923 | NEIGHBOR_STR | |
1924 | NEIGHBOR_ADDR_STR2 | |
1925 | "Configure a neighbor as Route Reflector client\n") | |
1926 | { | |
1927 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1928 | bgp_node_safi (vty), | |
1929 | PEER_FLAG_REFLECTOR_CLIENT); | |
1930 | } | |
1931 | \f | |
fee0f4c6 | 1932 | int |
fd79ac91 | 1933 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
1934 | int afi, int safi) | |
fee0f4c6 | 1935 | { |
1936 | int ret; | |
1937 | struct bgp *bgp; | |
1938 | struct peer *peer; | |
1939 | struct peer_group *group; | |
1940 | struct listnode *nn; | |
1941 | struct bgp_filter *pfilter; | |
1942 | struct bgp_filter *gfilter; | |
1943 | ||
1944 | bgp = vty->index; | |
1945 | ||
1946 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
1947 | if ( ! peer ) | |
1948 | return CMD_WARNING; | |
1949 | ||
1950 | /* If it is already a RS-Client, don't do anything. */ | |
1951 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
1952 | return CMD_SUCCESS; | |
1953 | ||
1954 | if ( ! peer_rsclient_active (peer) ) | |
1955 | listnode_add_sort (bgp->rsclient, peer); | |
1956 | ||
1957 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
1958 | if (ret < 0) | |
1959 | return bgp_vty_return (vty, ret); | |
1960 | ||
1961 | peer->rib[afi][safi] = bgp_table_init (); | |
1962 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; | |
1963 | peer->rib[afi][safi]->owner = peer; | |
1964 | ||
1965 | /* Check for existing 'network' and 'redistribute' routes. */ | |
1966 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
1967 | ||
1968 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
1969 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
1970 | ||
1971 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
1972 | { | |
1973 | group = peer->group; | |
1974 | gfilter = &peer->filter[afi][safi]; | |
1975 | ||
1976 | LIST_LOOP(group->peer, peer, nn) | |
1977 | { | |
1978 | pfilter = &peer->filter[afi][safi]; | |
1979 | ||
1980 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
1981 | is checked when the become part of the peer-group */ | |
1982 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
1983 | if (ret < 0) | |
1984 | return bgp_vty_return (vty, ret); | |
1985 | ||
1986 | /* Make peer's RIB point to group's RIB. */ | |
1987 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
1988 | ||
1989 | /* Import policy. */ | |
1990 | if (pfilter->map[RMAP_IMPORT].name) | |
1991 | free (pfilter->map[RMAP_IMPORT].name); | |
1992 | if (gfilter->map[RMAP_IMPORT].name) | |
1993 | { | |
1994 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); | |
1995 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; | |
1996 | } | |
1997 | else | |
1998 | { | |
1999 | pfilter->map[RMAP_IMPORT].name = NULL; | |
2000 | pfilter->map[RMAP_IMPORT].map =NULL; | |
2001 | } | |
2002 | ||
2003 | /* Export policy. */ | |
2004 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
2005 | { | |
2006 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); | |
2007 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; | |
2008 | } | |
2009 | } | |
2010 | } | |
2011 | return CMD_SUCCESS; | |
2012 | } | |
2013 | ||
2014 | int | |
fd79ac91 | 2015 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
2016 | int afi, int safi) | |
fee0f4c6 | 2017 | { |
2018 | int ret; | |
2019 | struct bgp *bgp; | |
2020 | struct peer *peer; | |
2021 | struct peer_group *group; | |
2022 | struct listnode *nn; | |
2023 | ||
2024 | bgp = vty->index; | |
2025 | ||
2026 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2027 | if ( ! peer ) | |
2028 | return CMD_WARNING; | |
2029 | ||
2030 | /* If it is not a RS-Client, don't do anything. */ | |
2031 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2032 | return CMD_SUCCESS; | |
2033 | ||
2034 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2035 | { | |
2036 | group = peer->group; | |
2037 | ||
2038 | LIST_LOOP (group->peer, peer, nn) | |
2039 | { | |
2040 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2041 | if (ret < 0) | |
2042 | return bgp_vty_return (vty, ret); | |
2043 | ||
2044 | peer->rib[afi][safi] = NULL; | |
2045 | } | |
2046 | ||
2047 | peer = group->conf; | |
2048 | } | |
2049 | ||
2050 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2051 | if (ret < 0) | |
2052 | return bgp_vty_return (vty, ret); | |
2053 | ||
2054 | if ( ! peer_rsclient_active (peer) ) | |
2055 | listnode_delete (bgp->rsclient, peer); | |
2056 | ||
2057 | bgp_table_finish (peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); | |
2058 | ||
2059 | return CMD_SUCCESS; | |
2060 | } | |
2061 | \f | |
718e3744 | 2062 | /* neighbor route-server-client. */ |
2063 | DEFUN (neighbor_route_server_client, | |
2064 | neighbor_route_server_client_cmd, | |
2065 | NEIGHBOR_CMD2 "route-server-client", | |
2066 | NEIGHBOR_STR | |
2067 | NEIGHBOR_ADDR_STR2 | |
2068 | "Configure a neighbor as Route Server client\n") | |
2069 | { | |
fee0f4c6 | 2070 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
2071 | bgp_node_safi(vty)); | |
718e3744 | 2072 | } |
2073 | ||
2074 | DEFUN (no_neighbor_route_server_client, | |
2075 | no_neighbor_route_server_client_cmd, | |
2076 | NO_NEIGHBOR_CMD2 "route-server-client", | |
2077 | NO_STR | |
2078 | NEIGHBOR_STR | |
2079 | NEIGHBOR_ADDR_STR2 | |
2080 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 2081 | { |
2082 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
2083 | bgp_node_safi(vty)); | |
2084 | } | |
2085 | \f | |
2086 | DEFUN (neighbor_nexthop_local_unchanged, | |
2087 | neighbor_nexthop_local_unchanged_cmd, | |
2088 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2089 | NEIGHBOR_STR | |
2090 | NEIGHBOR_ADDR_STR2 | |
2091 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
2092 | "Leave link-local nexthop unchanged for this peer\n") | |
2093 | { | |
2094 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2095 | bgp_node_safi (vty), | |
2096 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
2097 | } | |
2098 | \f | |
2099 | DEFUN (no_neighbor_nexthop_local_unchanged, | |
2100 | no_neighbor_nexthop_local_unchanged_cmd, | |
2101 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2102 | NO_STR | |
2103 | NEIGHBOR_STR | |
2104 | NEIGHBOR_ADDR_STR2 | |
2105 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
2106 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 2107 | { |
2108 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2109 | bgp_node_safi (vty), | |
fee0f4c6 | 2110 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 2111 | } |
2112 | \f | |
2113 | DEFUN (neighbor_attr_unchanged, | |
2114 | neighbor_attr_unchanged_cmd, | |
2115 | NEIGHBOR_CMD2 "attribute-unchanged", | |
2116 | NEIGHBOR_STR | |
2117 | NEIGHBOR_ADDR_STR2 | |
2118 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2119 | { | |
2120 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2121 | bgp_node_safi (vty), | |
2122 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2123 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2124 | PEER_FLAG_MED_UNCHANGED)); | |
2125 | } | |
2126 | ||
2127 | DEFUN (neighbor_attr_unchanged1, | |
2128 | neighbor_attr_unchanged1_cmd, | |
2129 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2130 | NEIGHBOR_STR | |
2131 | NEIGHBOR_ADDR_STR2 | |
2132 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2133 | "As-path attribute\n" | |
2134 | "Nexthop attribute\n" | |
2135 | "Med attribute\n") | |
2136 | { | |
2137 | u_int16_t flags = 0; | |
2138 | ||
2139 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2140 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2141 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2142 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2143 | else if (strncmp (argv[1], "med", 1) == 0) | |
2144 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2145 | ||
2146 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2147 | bgp_node_safi (vty), flags); | |
2148 | } | |
2149 | ||
2150 | DEFUN (neighbor_attr_unchanged2, | |
2151 | neighbor_attr_unchanged2_cmd, | |
2152 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2153 | NEIGHBOR_STR | |
2154 | NEIGHBOR_ADDR_STR2 | |
2155 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2156 | "As-path attribute\n" | |
2157 | "Nexthop attribute\n" | |
2158 | "Med attribute\n") | |
2159 | { | |
2160 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2161 | ||
2162 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2163 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2164 | else if (strncmp (argv[1], "med", 1) == 0) | |
2165 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2166 | ||
2167 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2168 | bgp_node_safi (vty), flags); | |
2169 | ||
2170 | } | |
2171 | ||
2172 | DEFUN (neighbor_attr_unchanged3, | |
2173 | neighbor_attr_unchanged3_cmd, | |
2174 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2175 | NEIGHBOR_STR | |
2176 | NEIGHBOR_ADDR_STR2 | |
2177 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2178 | "Nexthop attribute\n" | |
2179 | "As-path attribute\n" | |
2180 | "Med attribute\n") | |
2181 | { | |
2182 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2183 | ||
2184 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2185 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2186 | else if (strncmp (argv[1], "med", 1) == 0) | |
2187 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2188 | ||
2189 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2190 | bgp_node_safi (vty), flags); | |
2191 | } | |
2192 | ||
2193 | DEFUN (neighbor_attr_unchanged4, | |
2194 | neighbor_attr_unchanged4_cmd, | |
2195 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
2196 | NEIGHBOR_STR | |
2197 | NEIGHBOR_ADDR_STR2 | |
2198 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2199 | "Med attribute\n" | |
2200 | "As-path attribute\n" | |
2201 | "Nexthop attribute\n") | |
2202 | { | |
2203 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
2204 | ||
2205 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2206 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2207 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2208 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2209 | ||
2210 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2211 | bgp_node_safi (vty), flags); | |
2212 | } | |
2213 | ||
2214 | ALIAS (neighbor_attr_unchanged, | |
2215 | neighbor_attr_unchanged5_cmd, | |
2216 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
2217 | NEIGHBOR_STR | |
2218 | NEIGHBOR_ADDR_STR2 | |
2219 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2220 | "As-path attribute\n" | |
2221 | "Nexthop attribute\n" | |
2222 | "Med attribute\n") | |
2223 | ||
2224 | ALIAS (neighbor_attr_unchanged, | |
2225 | neighbor_attr_unchanged6_cmd, | |
2226 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
2227 | NEIGHBOR_STR | |
2228 | NEIGHBOR_ADDR_STR2 | |
2229 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2230 | "As-path attribute\n" | |
2231 | "Med attribute\n" | |
2232 | "Nexthop attribute\n") | |
2233 | ||
2234 | ALIAS (neighbor_attr_unchanged, | |
2235 | neighbor_attr_unchanged7_cmd, | |
2236 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
2237 | NEIGHBOR_STR | |
2238 | NEIGHBOR_ADDR_STR2 | |
2239 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2240 | "Nexthop attribute\n" | |
2241 | "Med attribute\n" | |
2242 | "As-path attribute\n") | |
2243 | ||
2244 | ALIAS (neighbor_attr_unchanged, | |
2245 | neighbor_attr_unchanged8_cmd, | |
2246 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
2247 | NEIGHBOR_STR | |
2248 | NEIGHBOR_ADDR_STR2 | |
2249 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2250 | "Nexthop attribute\n" | |
2251 | "As-path attribute\n" | |
2252 | "Med attribute\n") | |
2253 | ||
2254 | ALIAS (neighbor_attr_unchanged, | |
2255 | neighbor_attr_unchanged9_cmd, | |
2256 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
2257 | NEIGHBOR_STR | |
2258 | NEIGHBOR_ADDR_STR2 | |
2259 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2260 | "Med attribute\n" | |
2261 | "Nexthop attribute\n" | |
2262 | "As-path attribute\n") | |
2263 | ||
2264 | ALIAS (neighbor_attr_unchanged, | |
2265 | neighbor_attr_unchanged10_cmd, | |
2266 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
2267 | NEIGHBOR_STR | |
2268 | NEIGHBOR_ADDR_STR2 | |
2269 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2270 | "Med attribute\n" | |
2271 | "As-path attribute\n" | |
2272 | "Nexthop attribute\n") | |
2273 | ||
2274 | DEFUN (no_neighbor_attr_unchanged, | |
2275 | no_neighbor_attr_unchanged_cmd, | |
2276 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
2277 | NO_STR | |
2278 | NEIGHBOR_STR | |
2279 | NEIGHBOR_ADDR_STR2 | |
2280 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2281 | { | |
2282 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2283 | bgp_node_safi (vty), | |
2284 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2285 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2286 | PEER_FLAG_MED_UNCHANGED)); | |
2287 | } | |
2288 | ||
2289 | DEFUN (no_neighbor_attr_unchanged1, | |
2290 | no_neighbor_attr_unchanged1_cmd, | |
2291 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2292 | NO_STR | |
2293 | NEIGHBOR_STR | |
2294 | NEIGHBOR_ADDR_STR2 | |
2295 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2296 | "As-path attribute\n" | |
2297 | "Nexthop attribute\n" | |
2298 | "Med attribute\n") | |
2299 | { | |
2300 | u_int16_t flags = 0; | |
2301 | ||
2302 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2303 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2304 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2305 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2306 | else if (strncmp (argv[1], "med", 1) == 0) | |
2307 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2308 | ||
2309 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2310 | bgp_node_safi (vty), flags); | |
2311 | } | |
2312 | ||
2313 | DEFUN (no_neighbor_attr_unchanged2, | |
2314 | no_neighbor_attr_unchanged2_cmd, | |
2315 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2316 | NO_STR | |
2317 | NEIGHBOR_STR | |
2318 | NEIGHBOR_ADDR_STR2 | |
2319 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2320 | "As-path attribute\n" | |
2321 | "Nexthop attribute\n" | |
2322 | "Med attribute\n") | |
2323 | { | |
2324 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2325 | ||
2326 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2327 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2328 | else if (strncmp (argv[1], "med", 1) == 0) | |
2329 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2330 | ||
2331 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2332 | bgp_node_safi (vty), flags); | |
2333 | } | |
2334 | ||
2335 | DEFUN (no_neighbor_attr_unchanged3, | |
2336 | no_neighbor_attr_unchanged3_cmd, | |
2337 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2338 | NO_STR | |
2339 | NEIGHBOR_STR | |
2340 | NEIGHBOR_ADDR_STR2 | |
2341 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2342 | "Nexthop attribute\n" | |
2343 | "As-path attribute\n" | |
2344 | "Med attribute\n") | |
2345 | { | |
2346 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2347 | ||
2348 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2349 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2350 | else if (strncmp (argv[1], "med", 1) == 0) | |
2351 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2352 | ||
2353 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2354 | bgp_node_safi (vty), flags); | |
2355 | } | |
2356 | ||
2357 | DEFUN (no_neighbor_attr_unchanged4, | |
2358 | no_neighbor_attr_unchanged4_cmd, | |
2359 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
2360 | NO_STR | |
2361 | NEIGHBOR_STR | |
2362 | NEIGHBOR_ADDR_STR2 | |
2363 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2364 | "Med attribute\n" | |
2365 | "As-path attribute\n" | |
2366 | "Nexthop attribute\n") | |
2367 | { | |
2368 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
2369 | ||
2370 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2371 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2372 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2373 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2374 | ||
2375 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2376 | bgp_node_safi (vty), flags); | |
2377 | } | |
2378 | ||
2379 | ALIAS (no_neighbor_attr_unchanged, | |
2380 | no_neighbor_attr_unchanged5_cmd, | |
2381 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
2382 | NO_STR | |
2383 | NEIGHBOR_STR | |
2384 | NEIGHBOR_ADDR_STR2 | |
2385 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2386 | "As-path attribute\n" | |
2387 | "Nexthop attribute\n" | |
2388 | "Med attribute\n") | |
2389 | ||
2390 | ALIAS (no_neighbor_attr_unchanged, | |
2391 | no_neighbor_attr_unchanged6_cmd, | |
2392 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
2393 | NO_STR | |
2394 | NEIGHBOR_STR | |
2395 | NEIGHBOR_ADDR_STR2 | |
2396 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2397 | "As-path attribute\n" | |
2398 | "Med attribute\n" | |
2399 | "Nexthop attribute\n") | |
2400 | ||
2401 | ALIAS (no_neighbor_attr_unchanged, | |
2402 | no_neighbor_attr_unchanged7_cmd, | |
2403 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
2404 | NO_STR | |
2405 | NEIGHBOR_STR | |
2406 | NEIGHBOR_ADDR_STR2 | |
2407 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2408 | "Nexthop attribute\n" | |
2409 | "Med attribute\n" | |
2410 | "As-path attribute\n") | |
2411 | ||
2412 | ALIAS (no_neighbor_attr_unchanged, | |
2413 | no_neighbor_attr_unchanged8_cmd, | |
2414 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
2415 | NO_STR | |
2416 | NEIGHBOR_STR | |
2417 | NEIGHBOR_ADDR_STR2 | |
2418 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2419 | "Nexthop attribute\n" | |
2420 | "As-path attribute\n" | |
2421 | "Med attribute\n") | |
2422 | ||
2423 | ALIAS (no_neighbor_attr_unchanged, | |
2424 | no_neighbor_attr_unchanged9_cmd, | |
2425 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
2426 | NO_STR | |
2427 | NEIGHBOR_STR | |
2428 | NEIGHBOR_ADDR_STR2 | |
2429 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2430 | "Med attribute\n" | |
2431 | "Nexthop attribute\n" | |
2432 | "As-path attribute\n") | |
2433 | ||
2434 | ALIAS (no_neighbor_attr_unchanged, | |
2435 | no_neighbor_attr_unchanged10_cmd, | |
2436 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
2437 | NO_STR | |
2438 | NEIGHBOR_STR | |
2439 | NEIGHBOR_ADDR_STR2 | |
2440 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2441 | "Med attribute\n" | |
2442 | "As-path attribute\n" | |
2443 | "Nexthop attribute\n") | |
2444 | ||
2445 | /* For old version Zebra compatibility. */ | |
2446 | DEFUN (neighbor_transparent_as, | |
2447 | neighbor_transparent_as_cmd, | |
2448 | NEIGHBOR_CMD "transparent-as", | |
2449 | NEIGHBOR_STR | |
2450 | NEIGHBOR_ADDR_STR | |
2451 | "Do not append my AS number even peer is EBGP peer\n") | |
2452 | { | |
2453 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2454 | bgp_node_safi (vty), | |
2455 | PEER_FLAG_AS_PATH_UNCHANGED); | |
2456 | } | |
2457 | ||
2458 | DEFUN (neighbor_transparent_nexthop, | |
2459 | neighbor_transparent_nexthop_cmd, | |
2460 | NEIGHBOR_CMD "transparent-nexthop", | |
2461 | NEIGHBOR_STR | |
2462 | NEIGHBOR_ADDR_STR | |
2463 | "Do not change nexthop even peer is EBGP peer\n") | |
2464 | { | |
2465 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2466 | bgp_node_safi (vty), | |
2467 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
2468 | } | |
2469 | \f | |
2470 | /* EBGP multihop configuration. */ | |
2471 | int | |
fd79ac91 | 2472 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
2473 | const char *ttl_str) | |
718e3744 | 2474 | { |
2475 | struct peer *peer; | |
fd79ac91 | 2476 | unsigned int ttl; |
718e3744 | 2477 | |
2478 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2479 | if (! peer) | |
2480 | return CMD_WARNING; | |
2481 | ||
2482 | if (! ttl_str) | |
2483 | ttl = TTL_MAX; | |
2484 | else | |
2485 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
2486 | ||
2487 | peer_ebgp_multihop_set (peer, ttl); | |
2488 | ||
2489 | return CMD_SUCCESS; | |
2490 | } | |
2491 | ||
2492 | int | |
fd79ac91 | 2493 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 2494 | { |
2495 | struct peer *peer; | |
2496 | ||
2497 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2498 | if (! peer) | |
2499 | return CMD_WARNING; | |
2500 | ||
2501 | peer_ebgp_multihop_unset (peer); | |
2502 | ||
2503 | return CMD_SUCCESS; | |
2504 | } | |
2505 | ||
2506 | /* neighbor ebgp-multihop. */ | |
2507 | DEFUN (neighbor_ebgp_multihop, | |
2508 | neighbor_ebgp_multihop_cmd, | |
2509 | NEIGHBOR_CMD2 "ebgp-multihop", | |
2510 | NEIGHBOR_STR | |
2511 | NEIGHBOR_ADDR_STR2 | |
2512 | "Allow EBGP neighbors not on directly connected networks\n") | |
2513 | { | |
2514 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
2515 | } | |
2516 | ||
2517 | DEFUN (neighbor_ebgp_multihop_ttl, | |
2518 | neighbor_ebgp_multihop_ttl_cmd, | |
2519 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
2520 | NEIGHBOR_STR | |
2521 | NEIGHBOR_ADDR_STR2 | |
2522 | "Allow EBGP neighbors not on directly connected networks\n" | |
2523 | "maximum hop count\n") | |
2524 | { | |
2525 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
2526 | } | |
2527 | ||
2528 | DEFUN (no_neighbor_ebgp_multihop, | |
2529 | no_neighbor_ebgp_multihop_cmd, | |
2530 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
2531 | NO_STR | |
2532 | NEIGHBOR_STR | |
2533 | NEIGHBOR_ADDR_STR2 | |
2534 | "Allow EBGP neighbors not on directly connected networks\n") | |
2535 | { | |
2536 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
2537 | } | |
2538 | ||
2539 | ALIAS (no_neighbor_ebgp_multihop, | |
2540 | no_neighbor_ebgp_multihop_ttl_cmd, | |
2541 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
2542 | NO_STR | |
2543 | NEIGHBOR_STR | |
2544 | NEIGHBOR_ADDR_STR2 | |
2545 | "Allow EBGP neighbors not on directly connected networks\n" | |
2546 | "maximum hop count\n") | |
2547 | \f | |
2548 | /* Enforce multihop. */ | |
2549 | DEFUN (neighbor_enforce_multihop, | |
2550 | neighbor_enforce_multihop_cmd, | |
2551 | NEIGHBOR_CMD2 "enforce-multihop", | |
2552 | NEIGHBOR_STR | |
2553 | NEIGHBOR_ADDR_STR2 | |
2554 | "Enforce EBGP neighbors perform multihop\n") | |
2555 | { | |
2556 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_ENFORCE_MULTIHOP); | |
2557 | } | |
2558 | ||
2559 | DEFUN (no_neighbor_enforce_multihop, | |
2560 | no_neighbor_enforce_multihop_cmd, | |
2561 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
2562 | NO_STR | |
2563 | NEIGHBOR_STR | |
2564 | NEIGHBOR_ADDR_STR2 | |
2565 | "Enforce EBGP neighbors perform multihop\n") | |
2566 | { | |
2567 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_ENFORCE_MULTIHOP); | |
2568 | } | |
2569 | \f | |
2570 | DEFUN (neighbor_description, | |
2571 | neighbor_description_cmd, | |
2572 | NEIGHBOR_CMD2 "description .LINE", | |
2573 | NEIGHBOR_STR | |
2574 | NEIGHBOR_ADDR_STR2 | |
2575 | "Neighbor specific description\n" | |
2576 | "Up to 80 characters describing this neighbor\n") | |
2577 | { | |
2578 | struct peer *peer; | |
2579 | struct buffer *b; | |
2580 | char *str; | |
2581 | int i; | |
2582 | ||
2583 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2584 | if (! peer) | |
2585 | return CMD_WARNING; | |
2586 | ||
2587 | if (argc == 1) | |
2588 | return CMD_SUCCESS; | |
2589 | ||
2590 | /* Make string from buffer. This function should be provided by | |
2591 | buffer.c. */ | |
2592 | b = buffer_new (1024); | |
2593 | for (i = 1; i < argc; i++) | |
2594 | { | |
c9e52be3 | 2595 | buffer_putstr (b, argv[i]); |
718e3744 | 2596 | buffer_putc (b, ' '); |
2597 | } | |
2598 | buffer_putc (b, '\0'); | |
2599 | str = buffer_getstr (b); | |
2600 | buffer_free (b); | |
2601 | ||
2602 | peer_description_set (peer, str); | |
2603 | ||
2604 | free (str); | |
2605 | ||
2606 | return CMD_SUCCESS; | |
2607 | } | |
2608 | ||
2609 | DEFUN (no_neighbor_description, | |
2610 | no_neighbor_description_cmd, | |
2611 | NO_NEIGHBOR_CMD2 "description", | |
2612 | NO_STR | |
2613 | NEIGHBOR_STR | |
2614 | NEIGHBOR_ADDR_STR2 | |
2615 | "Neighbor specific description\n") | |
2616 | { | |
2617 | struct peer *peer; | |
2618 | ||
2619 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2620 | if (! peer) | |
2621 | return CMD_WARNING; | |
2622 | ||
2623 | peer_description_unset (peer); | |
2624 | ||
2625 | return CMD_SUCCESS; | |
2626 | } | |
2627 | ||
2628 | ALIAS (no_neighbor_description, | |
2629 | no_neighbor_description_val_cmd, | |
2630 | NO_NEIGHBOR_CMD2 "description .LINE", | |
2631 | NO_STR | |
2632 | NEIGHBOR_STR | |
2633 | NEIGHBOR_ADDR_STR2 | |
2634 | "Neighbor specific description\n" | |
2635 | "Up to 80 characters describing this neighbor\n") | |
2636 | \f | |
2637 | /* Neighbor update-source. */ | |
2638 | int | |
fd79ac91 | 2639 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
2640 | const char *source_str) | |
718e3744 | 2641 | { |
2642 | struct peer *peer; | |
2643 | union sockunion *su; | |
2644 | ||
2645 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2646 | if (! peer) | |
2647 | return CMD_WARNING; | |
2648 | ||
2649 | if (source_str) | |
2650 | { | |
2651 | su = sockunion_str2su (source_str); | |
2652 | if (su) | |
2653 | { | |
2654 | peer_update_source_addr_set (peer, su); | |
2655 | sockunion_free (su); | |
2656 | } | |
2657 | else | |
2658 | peer_update_source_if_set (peer, source_str); | |
2659 | } | |
2660 | else | |
2661 | peer_update_source_unset (peer); | |
2662 | ||
2663 | return CMD_SUCCESS; | |
2664 | } | |
2665 | ||
2666 | DEFUN (neighbor_update_source, | |
2667 | neighbor_update_source_cmd, | |
2668 | NEIGHBOR_CMD2 "update-source WORD", | |
2669 | NEIGHBOR_STR | |
2670 | NEIGHBOR_ADDR_STR2 | |
2671 | "Source of routing updates\n" | |
2672 | "Interface name\n") | |
2673 | { | |
2674 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
2675 | } | |
2676 | ||
2677 | DEFUN (no_neighbor_update_source, | |
2678 | no_neighbor_update_source_cmd, | |
2679 | NO_NEIGHBOR_CMD2 "update-source", | |
2680 | NO_STR | |
2681 | NEIGHBOR_STR | |
2682 | NEIGHBOR_ADDR_STR2 | |
2683 | "Source of routing updates\n" | |
2684 | "Interface name\n") | |
2685 | { | |
2686 | return peer_update_source_vty (vty, argv[0], NULL); | |
2687 | } | |
2688 | \f | |
2689 | int | |
fd79ac91 | 2690 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
2691 | afi_t afi, safi_t safi, | |
2692 | const char *rmap, int set) | |
718e3744 | 2693 | { |
2694 | int ret; | |
2695 | struct peer *peer; | |
2696 | ||
2697 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2698 | if (! peer) | |
2699 | return CMD_WARNING; | |
2700 | ||
2701 | if (set) | |
2702 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
2703 | else | |
2704 | ret = peer_default_originate_unset (peer, afi, safi); | |
2705 | ||
2706 | return bgp_vty_return (vty, ret); | |
2707 | } | |
2708 | ||
2709 | /* neighbor default-originate. */ | |
2710 | DEFUN (neighbor_default_originate, | |
2711 | neighbor_default_originate_cmd, | |
2712 | NEIGHBOR_CMD2 "default-originate", | |
2713 | NEIGHBOR_STR | |
2714 | NEIGHBOR_ADDR_STR2 | |
2715 | "Originate default route to this neighbor\n") | |
2716 | { | |
2717 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2718 | bgp_node_safi (vty), NULL, 1); | |
2719 | } | |
2720 | ||
2721 | DEFUN (neighbor_default_originate_rmap, | |
2722 | neighbor_default_originate_rmap_cmd, | |
2723 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
2724 | NEIGHBOR_STR | |
2725 | NEIGHBOR_ADDR_STR2 | |
2726 | "Originate default route to this neighbor\n" | |
2727 | "Route-map to specify criteria to originate default\n" | |
2728 | "route-map name\n") | |
2729 | { | |
2730 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2731 | bgp_node_safi (vty), argv[1], 1); | |
2732 | } | |
2733 | ||
2734 | DEFUN (no_neighbor_default_originate, | |
2735 | no_neighbor_default_originate_cmd, | |
2736 | NO_NEIGHBOR_CMD2 "default-originate", | |
2737 | NO_STR | |
2738 | NEIGHBOR_STR | |
2739 | NEIGHBOR_ADDR_STR2 | |
2740 | "Originate default route to this neighbor\n") | |
2741 | { | |
2742 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2743 | bgp_node_safi (vty), NULL, 0); | |
2744 | } | |
2745 | ||
2746 | ALIAS (no_neighbor_default_originate, | |
2747 | no_neighbor_default_originate_rmap_cmd, | |
2748 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
2749 | NO_STR | |
2750 | NEIGHBOR_STR | |
2751 | NEIGHBOR_ADDR_STR2 | |
2752 | "Originate default route to this neighbor\n" | |
2753 | "Route-map to specify criteria to originate default\n" | |
2754 | "route-map name\n") | |
2755 | \f | |
2756 | /* Set neighbor's BGP port. */ | |
2757 | int | |
fd79ac91 | 2758 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
2759 | const char *port_str) | |
718e3744 | 2760 | { |
2761 | struct peer *peer; | |
2762 | u_int16_t port; | |
2763 | struct servent *sp; | |
2764 | ||
2765 | peer = peer_lookup_vty (vty, ip_str); | |
2766 | if (! peer) | |
2767 | return CMD_WARNING; | |
2768 | ||
2769 | if (! port_str) | |
2770 | { | |
2771 | sp = getservbyname ("bgp", "tcp"); | |
2772 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
2773 | } | |
2774 | else | |
2775 | { | |
2776 | VTY_GET_INTEGER("port", port, port_str); | |
2777 | } | |
2778 | ||
2779 | peer_port_set (peer, port); | |
2780 | ||
2781 | return CMD_SUCCESS; | |
2782 | } | |
2783 | ||
2784 | /* Set specified peer's BGP version. */ | |
2785 | DEFUN (neighbor_port, | |
2786 | neighbor_port_cmd, | |
2787 | NEIGHBOR_CMD "port <0-65535>", | |
2788 | NEIGHBOR_STR | |
2789 | NEIGHBOR_ADDR_STR | |
2790 | "Neighbor's BGP port\n" | |
2791 | "TCP port number\n") | |
2792 | { | |
2793 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
2794 | } | |
2795 | ||
2796 | DEFUN (no_neighbor_port, | |
2797 | no_neighbor_port_cmd, | |
2798 | NO_NEIGHBOR_CMD "port", | |
2799 | NO_STR | |
2800 | NEIGHBOR_STR | |
2801 | NEIGHBOR_ADDR_STR | |
2802 | "Neighbor's BGP port\n") | |
2803 | { | |
2804 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
2805 | } | |
2806 | ||
2807 | ALIAS (no_neighbor_port, | |
2808 | no_neighbor_port_val_cmd, | |
2809 | NO_NEIGHBOR_CMD "port <0-65535>", | |
2810 | NO_STR | |
2811 | NEIGHBOR_STR | |
2812 | NEIGHBOR_ADDR_STR | |
2813 | "Neighbor's BGP port\n" | |
2814 | "TCP port number\n") | |
2815 | \f | |
2816 | /* neighbor weight. */ | |
2817 | int | |
fd79ac91 | 2818 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
2819 | const char *weight_str) | |
718e3744 | 2820 | { |
2821 | int ret; | |
2822 | struct peer *peer; | |
2823 | unsigned long weight; | |
2824 | ||
2825 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2826 | if (! peer) | |
2827 | return CMD_WARNING; | |
2828 | ||
2829 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
2830 | ||
2831 | ret = peer_weight_set (peer, weight); | |
2832 | ||
2833 | return CMD_SUCCESS; | |
2834 | } | |
2835 | ||
2836 | int | |
fd79ac91 | 2837 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 2838 | { |
2839 | struct peer *peer; | |
2840 | ||
2841 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2842 | if (! peer) | |
2843 | return CMD_WARNING; | |
2844 | ||
2845 | peer_weight_unset (peer); | |
2846 | ||
2847 | return CMD_SUCCESS; | |
2848 | } | |
2849 | ||
2850 | DEFUN (neighbor_weight, | |
2851 | neighbor_weight_cmd, | |
2852 | NEIGHBOR_CMD2 "weight <0-65535>", | |
2853 | NEIGHBOR_STR | |
2854 | NEIGHBOR_ADDR_STR2 | |
2855 | "Set default weight for routes from this neighbor\n" | |
2856 | "default weight\n") | |
2857 | { | |
2858 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
2859 | } | |
2860 | ||
2861 | DEFUN (no_neighbor_weight, | |
2862 | no_neighbor_weight_cmd, | |
2863 | NO_NEIGHBOR_CMD2 "weight", | |
2864 | NO_STR | |
2865 | NEIGHBOR_STR | |
2866 | NEIGHBOR_ADDR_STR2 | |
2867 | "Set default weight for routes from this neighbor\n") | |
2868 | { | |
2869 | return peer_weight_unset_vty (vty, argv[0]); | |
2870 | } | |
2871 | ||
2872 | ALIAS (no_neighbor_weight, | |
2873 | no_neighbor_weight_val_cmd, | |
2874 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
2875 | NO_STR | |
2876 | NEIGHBOR_STR | |
2877 | NEIGHBOR_ADDR_STR2 | |
2878 | "Set default weight for routes from this neighbor\n" | |
2879 | "default weight\n") | |
2880 | \f | |
2881 | /* Override capability negotiation. */ | |
2882 | DEFUN (neighbor_override_capability, | |
2883 | neighbor_override_capability_cmd, | |
2884 | NEIGHBOR_CMD2 "override-capability", | |
2885 | NEIGHBOR_STR | |
2886 | NEIGHBOR_ADDR_STR2 | |
2887 | "Override capability negotiation result\n") | |
2888 | { | |
2889 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
2890 | } | |
2891 | ||
2892 | DEFUN (no_neighbor_override_capability, | |
2893 | no_neighbor_override_capability_cmd, | |
2894 | NO_NEIGHBOR_CMD2 "override-capability", | |
2895 | NO_STR | |
2896 | NEIGHBOR_STR | |
2897 | NEIGHBOR_ADDR_STR2 | |
2898 | "Override capability negotiation result\n") | |
2899 | { | |
2900 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
2901 | } | |
2902 | \f | |
2903 | DEFUN (neighbor_strict_capability, | |
2904 | neighbor_strict_capability_cmd, | |
2905 | NEIGHBOR_CMD "strict-capability-match", | |
2906 | NEIGHBOR_STR | |
2907 | NEIGHBOR_ADDR_STR | |
2908 | "Strict capability negotiation match\n") | |
2909 | { | |
2910 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
2911 | } | |
2912 | ||
2913 | DEFUN (no_neighbor_strict_capability, | |
2914 | no_neighbor_strict_capability_cmd, | |
2915 | NO_NEIGHBOR_CMD "strict-capability-match", | |
2916 | NO_STR | |
2917 | NEIGHBOR_STR | |
2918 | NEIGHBOR_ADDR_STR | |
2919 | "Strict capability negotiation match\n") | |
2920 | { | |
2921 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
2922 | } | |
2923 | \f | |
2924 | int | |
fd79ac91 | 2925 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
2926 | const char *keep_str, const char *hold_str) | |
718e3744 | 2927 | { |
2928 | int ret; | |
2929 | struct peer *peer; | |
2930 | u_int32_t keepalive; | |
2931 | u_int32_t holdtime; | |
2932 | ||
2933 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2934 | if (! peer) | |
2935 | return CMD_WARNING; | |
2936 | ||
2937 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
2938 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
2939 | ||
2940 | ret = peer_timers_set (peer, keepalive, holdtime); | |
2941 | ||
2942 | return bgp_vty_return (vty, ret); | |
2943 | } | |
2944 | \f | |
2945 | int | |
fd79ac91 | 2946 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 2947 | { |
2948 | int ret; | |
2949 | struct peer *peer; | |
2950 | ||
2951 | peer = peer_lookup_vty (vty, ip_str); | |
2952 | if (! peer) | |
2953 | return CMD_WARNING; | |
2954 | ||
2955 | ret = peer_timers_unset (peer); | |
2956 | ||
2957 | return bgp_vty_return (vty, ret); | |
2958 | } | |
2959 | ||
2960 | DEFUN (neighbor_timers, | |
2961 | neighbor_timers_cmd, | |
2962 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
2963 | NEIGHBOR_STR | |
2964 | NEIGHBOR_ADDR_STR2 | |
2965 | "BGP per neighbor timers\n" | |
2966 | "Keepalive interval\n" | |
2967 | "Holdtime\n") | |
2968 | { | |
2969 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
2970 | } | |
2971 | ||
2972 | DEFUN (no_neighbor_timers, | |
2973 | no_neighbor_timers_cmd, | |
2974 | NO_NEIGHBOR_CMD2 "timers", | |
2975 | NO_STR | |
2976 | NEIGHBOR_STR | |
2977 | NEIGHBOR_ADDR_STR2 | |
2978 | "BGP per neighbor timers\n") | |
2979 | { | |
2980 | return peer_timers_unset_vty (vty, argv[0]); | |
2981 | } | |
2982 | \f | |
2983 | int | |
fd79ac91 | 2984 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
2985 | const char *time_str) | |
718e3744 | 2986 | { |
2987 | int ret; | |
2988 | struct peer *peer; | |
2989 | u_int32_t connect; | |
2990 | ||
2991 | peer = peer_lookup_vty (vty, ip_str); | |
2992 | if (! peer) | |
2993 | return CMD_WARNING; | |
2994 | ||
2995 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
2996 | ||
2997 | ret = peer_timers_connect_set (peer, connect); | |
2998 | ||
2999 | return CMD_SUCCESS; | |
3000 | } | |
3001 | ||
3002 | int | |
fd79ac91 | 3003 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3004 | { |
3005 | int ret; | |
3006 | struct peer *peer; | |
3007 | ||
3008 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3009 | if (! peer) | |
3010 | return CMD_WARNING; | |
3011 | ||
3012 | ret = peer_timers_connect_unset (peer); | |
3013 | ||
3014 | return CMD_SUCCESS; | |
3015 | } | |
3016 | ||
3017 | DEFUN (neighbor_timers_connect, | |
3018 | neighbor_timers_connect_cmd, | |
3019 | NEIGHBOR_CMD "timers connect <0-65535>", | |
3020 | NEIGHBOR_STR | |
3021 | NEIGHBOR_ADDR_STR | |
3022 | "BGP per neighbor timers\n" | |
3023 | "BGP connect timer\n" | |
3024 | "Connect timer\n") | |
3025 | { | |
3026 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
3027 | } | |
3028 | ||
3029 | DEFUN (no_neighbor_timers_connect, | |
3030 | no_neighbor_timers_connect_cmd, | |
3031 | NO_NEIGHBOR_CMD "timers connect", | |
3032 | NO_STR | |
3033 | NEIGHBOR_STR | |
3034 | NEIGHBOR_ADDR_STR | |
3035 | "BGP per neighbor timers\n" | |
3036 | "BGP connect timer\n") | |
3037 | { | |
3038 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
3039 | } | |
3040 | ||
3041 | ALIAS (no_neighbor_timers_connect, | |
3042 | no_neighbor_timers_connect_val_cmd, | |
3043 | NO_NEIGHBOR_CMD "timers connect <0-65535>", | |
3044 | NO_STR | |
3045 | NEIGHBOR_STR | |
3046 | NEIGHBOR_ADDR_STR | |
3047 | "BGP per neighbor timers\n" | |
3048 | "BGP connect timer\n" | |
3049 | "Connect timer\n") | |
3050 | \f | |
3051 | int | |
fd79ac91 | 3052 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
3053 | const char *time_str, int set) | |
718e3744 | 3054 | { |
3055 | int ret; | |
3056 | struct peer *peer; | |
3057 | u_int32_t routeadv = 0; | |
3058 | ||
3059 | peer = peer_lookup_vty (vty, ip_str); | |
3060 | if (! peer) | |
3061 | return CMD_WARNING; | |
3062 | ||
3063 | if (time_str) | |
3064 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
3065 | ||
3066 | if (set) | |
3067 | ret = peer_advertise_interval_set (peer, routeadv); | |
3068 | else | |
3069 | ret = peer_advertise_interval_unset (peer); | |
3070 | ||
3071 | return CMD_SUCCESS; | |
3072 | } | |
3073 | ||
3074 | DEFUN (neighbor_advertise_interval, | |
3075 | neighbor_advertise_interval_cmd, | |
3076 | NEIGHBOR_CMD "advertisement-interval <0-600>", | |
3077 | NEIGHBOR_STR | |
3078 | NEIGHBOR_ADDR_STR | |
3079 | "Minimum interval between sending BGP routing updates\n" | |
3080 | "time in seconds\n") | |
3081 | { | |
3082 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
3083 | } | |
3084 | ||
3085 | DEFUN (no_neighbor_advertise_interval, | |
3086 | no_neighbor_advertise_interval_cmd, | |
3087 | NO_NEIGHBOR_CMD "advertisement-interval", | |
3088 | NO_STR | |
3089 | NEIGHBOR_STR | |
3090 | NEIGHBOR_ADDR_STR | |
3091 | "Minimum interval between sending BGP routing updates\n") | |
3092 | { | |
3093 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
3094 | } | |
3095 | ||
3096 | ALIAS (no_neighbor_advertise_interval, | |
3097 | no_neighbor_advertise_interval_val_cmd, | |
3098 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", | |
3099 | NO_STR | |
3100 | NEIGHBOR_STR | |
3101 | NEIGHBOR_ADDR_STR | |
3102 | "Minimum interval between sending BGP routing updates\n" | |
3103 | "time in seconds\n") | |
3104 | \f | |
3105 | int | |
fd79ac91 | 3106 | peer_version_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 3107 | { |
3108 | int ret; | |
3109 | struct peer *peer; | |
3110 | int version = BGP_VERSION_4; | |
3111 | ||
3112 | peer = peer_lookup_vty (vty, ip_str); | |
3113 | if (! peer) | |
3114 | return CMD_WARNING; | |
3115 | ||
3116 | /* BGP version string check. */ | |
3117 | if (str) | |
3118 | { | |
3119 | if (strcmp (str, "4") == 0) | |
3120 | version = BGP_VERSION_4; | |
3121 | else if (strcmp (str, "4-") == 0) | |
3122 | version = BGP_VERSION_MP_4_DRAFT_00; | |
3123 | ||
3124 | ret = peer_version_set (peer, version); | |
3125 | } | |
3126 | else | |
3127 | ret = peer_version_unset (peer); | |
3128 | ||
3129 | return CMD_SUCCESS; | |
3130 | } | |
3131 | ||
3132 | DEFUN (neighbor_version, | |
3133 | neighbor_version_cmd, | |
3134 | NEIGHBOR_CMD "version (4|4-)", | |
3135 | NEIGHBOR_STR | |
3136 | NEIGHBOR_ADDR_STR | |
3137 | "Neighbor's BGP version\n" | |
3138 | "Border Gateway Protocol 4\n" | |
3139 | "Multiprotocol Extensions for BGP-4(Old Draft)\n") | |
3140 | { | |
3141 | return peer_version_vty (vty, argv[0], argv[1]); | |
3142 | } | |
3143 | ||
3144 | DEFUN (no_neighbor_version, | |
3145 | no_neighbor_version_cmd, | |
3146 | NO_NEIGHBOR_CMD "version", | |
3147 | NO_STR | |
3148 | NEIGHBOR_STR | |
3149 | NEIGHBOR_ADDR_STR | |
3150 | "Neighbor's BGP version\n") | |
3151 | { | |
3152 | return peer_version_vty (vty, argv[0], NULL); | |
3153 | } | |
3154 | \f | |
3155 | /* neighbor interface */ | |
3156 | int | |
fd79ac91 | 3157 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 3158 | { |
3159 | int ret; | |
3160 | struct peer *peer; | |
3161 | ||
3162 | peer = peer_lookup_vty (vty, ip_str); | |
3163 | if (! peer) | |
3164 | return CMD_WARNING; | |
3165 | ||
3166 | if (str) | |
3167 | ret = peer_interface_set (peer, str); | |
3168 | else | |
3169 | ret = peer_interface_unset (peer); | |
3170 | ||
3171 | return CMD_SUCCESS; | |
3172 | } | |
3173 | ||
3174 | DEFUN (neighbor_interface, | |
3175 | neighbor_interface_cmd, | |
3176 | NEIGHBOR_CMD "interface WORD", | |
3177 | NEIGHBOR_STR | |
3178 | NEIGHBOR_ADDR_STR | |
3179 | "Interface\n" | |
3180 | "Interface name\n") | |
3181 | { | |
3182 | return peer_interface_vty (vty, argv[0], argv[1]); | |
3183 | } | |
3184 | ||
3185 | DEFUN (no_neighbor_interface, | |
3186 | no_neighbor_interface_cmd, | |
3187 | NO_NEIGHBOR_CMD "interface WORD", | |
3188 | NO_STR | |
3189 | NEIGHBOR_STR | |
3190 | NEIGHBOR_ADDR_STR | |
3191 | "Interface\n" | |
3192 | "Interface name\n") | |
3193 | { | |
3194 | return peer_interface_vty (vty, argv[0], NULL); | |
3195 | } | |
3196 | \f | |
3197 | /* Set distribute list to the peer. */ | |
3198 | int | |
fd79ac91 | 3199 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
3200 | afi_t afi, safi_t safi, | |
3201 | const char *name_str, const char *direct_str) | |
718e3744 | 3202 | { |
3203 | int ret; | |
3204 | struct peer *peer; | |
3205 | int direct = FILTER_IN; | |
3206 | ||
3207 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3208 | if (! peer) | |
3209 | return CMD_WARNING; | |
3210 | ||
3211 | /* Check filter direction. */ | |
3212 | if (strncmp (direct_str, "i", 1) == 0) | |
3213 | direct = FILTER_IN; | |
3214 | else if (strncmp (direct_str, "o", 1) == 0) | |
3215 | direct = FILTER_OUT; | |
3216 | ||
3217 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
3218 | ||
3219 | return bgp_vty_return (vty, ret); | |
3220 | } | |
3221 | ||
3222 | int | |
fd79ac91 | 3223 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3224 | safi_t safi, const char *direct_str) | |
718e3744 | 3225 | { |
3226 | int ret; | |
3227 | struct peer *peer; | |
3228 | int direct = FILTER_IN; | |
3229 | ||
3230 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3231 | if (! peer) | |
3232 | return CMD_WARNING; | |
3233 | ||
3234 | /* Check filter direction. */ | |
3235 | if (strncmp (direct_str, "i", 1) == 0) | |
3236 | direct = FILTER_IN; | |
3237 | else if (strncmp (direct_str, "o", 1) == 0) | |
3238 | direct = FILTER_OUT; | |
3239 | ||
3240 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
3241 | ||
3242 | return bgp_vty_return (vty, ret); | |
3243 | } | |
3244 | ||
3245 | DEFUN (neighbor_distribute_list, | |
3246 | neighbor_distribute_list_cmd, | |
3247 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3248 | NEIGHBOR_STR | |
3249 | NEIGHBOR_ADDR_STR2 | |
3250 | "Filter updates to/from this neighbor\n" | |
3251 | "IP access-list number\n" | |
3252 | "IP access-list number (expanded range)\n" | |
3253 | "IP Access-list name\n" | |
3254 | "Filter incoming updates\n" | |
3255 | "Filter outgoing updates\n") | |
3256 | { | |
3257 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3258 | bgp_node_safi (vty), argv[1], argv[2]); | |
3259 | } | |
3260 | ||
3261 | DEFUN (no_neighbor_distribute_list, | |
3262 | no_neighbor_distribute_list_cmd, | |
3263 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3264 | NO_STR | |
3265 | NEIGHBOR_STR | |
3266 | NEIGHBOR_ADDR_STR2 | |
3267 | "Filter updates to/from this neighbor\n" | |
3268 | "IP access-list number\n" | |
3269 | "IP access-list number (expanded range)\n" | |
3270 | "IP Access-list name\n" | |
3271 | "Filter incoming updates\n" | |
3272 | "Filter outgoing updates\n") | |
3273 | { | |
3274 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3275 | bgp_node_safi (vty), argv[2]); | |
3276 | } | |
3277 | \f | |
3278 | /* Set prefix list to the peer. */ | |
3279 | int | |
fd79ac91 | 3280 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3281 | safi_t safi, const char *name_str, | |
3282 | const char *direct_str) | |
718e3744 | 3283 | { |
3284 | int ret; | |
3285 | struct peer *peer; | |
3286 | int direct = FILTER_IN; | |
3287 | ||
3288 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3289 | if (! peer) | |
3290 | return CMD_WARNING; | |
3291 | ||
3292 | /* Check filter direction. */ | |
3293 | if (strncmp (direct_str, "i", 1) == 0) | |
3294 | direct = FILTER_IN; | |
3295 | else if (strncmp (direct_str, "o", 1) == 0) | |
3296 | direct = FILTER_OUT; | |
3297 | ||
3298 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
3299 | ||
3300 | return bgp_vty_return (vty, ret); | |
3301 | } | |
3302 | ||
3303 | int | |
fd79ac91 | 3304 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3305 | safi_t safi, const char *direct_str) | |
718e3744 | 3306 | { |
3307 | int ret; | |
3308 | struct peer *peer; | |
3309 | int direct = FILTER_IN; | |
3310 | ||
3311 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3312 | if (! peer) | |
3313 | return CMD_WARNING; | |
3314 | ||
3315 | /* Check filter direction. */ | |
3316 | if (strncmp (direct_str, "i", 1) == 0) | |
3317 | direct = FILTER_IN; | |
3318 | else if (strncmp (direct_str, "o", 1) == 0) | |
3319 | direct = FILTER_OUT; | |
3320 | ||
3321 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
3322 | ||
3323 | return bgp_vty_return (vty, ret); | |
3324 | } | |
3325 | ||
3326 | DEFUN (neighbor_prefix_list, | |
3327 | neighbor_prefix_list_cmd, | |
3328 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3329 | NEIGHBOR_STR | |
3330 | NEIGHBOR_ADDR_STR2 | |
3331 | "Filter updates to/from this neighbor\n" | |
3332 | "Name of a prefix list\n" | |
3333 | "Filter incoming updates\n" | |
3334 | "Filter outgoing updates\n") | |
3335 | { | |
3336 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3337 | bgp_node_safi (vty), argv[1], argv[2]); | |
3338 | } | |
3339 | ||
3340 | DEFUN (no_neighbor_prefix_list, | |
3341 | no_neighbor_prefix_list_cmd, | |
3342 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3343 | NO_STR | |
3344 | NEIGHBOR_STR | |
3345 | NEIGHBOR_ADDR_STR2 | |
3346 | "Filter updates to/from this neighbor\n" | |
3347 | "Name of a prefix list\n" | |
3348 | "Filter incoming updates\n" | |
3349 | "Filter outgoing updates\n") | |
3350 | { | |
3351 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3352 | bgp_node_safi (vty), argv[2]); | |
3353 | } | |
3354 | \f | |
3355 | int | |
fd79ac91 | 3356 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
3357 | afi_t afi, safi_t safi, | |
3358 | const char *name_str, const char *direct_str) | |
718e3744 | 3359 | { |
3360 | int ret; | |
3361 | struct peer *peer; | |
3362 | int direct = FILTER_IN; | |
3363 | ||
3364 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3365 | if (! peer) | |
3366 | return CMD_WARNING; | |
3367 | ||
3368 | /* Check filter direction. */ | |
3369 | if (strncmp (direct_str, "i", 1) == 0) | |
3370 | direct = FILTER_IN; | |
3371 | else if (strncmp (direct_str, "o", 1) == 0) | |
3372 | direct = FILTER_OUT; | |
3373 | ||
3374 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
3375 | ||
3376 | return bgp_vty_return (vty, ret); | |
3377 | } | |
3378 | ||
3379 | int | |
fd79ac91 | 3380 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
3381 | afi_t afi, safi_t safi, | |
3382 | const char *direct_str) | |
718e3744 | 3383 | { |
3384 | int ret; | |
3385 | struct peer *peer; | |
3386 | int direct = FILTER_IN; | |
3387 | ||
3388 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3389 | if (! peer) | |
3390 | return CMD_WARNING; | |
3391 | ||
3392 | /* Check filter direction. */ | |
3393 | if (strncmp (direct_str, "i", 1) == 0) | |
3394 | direct = FILTER_IN; | |
3395 | else if (strncmp (direct_str, "o", 1) == 0) | |
3396 | direct = FILTER_OUT; | |
3397 | ||
3398 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
3399 | ||
3400 | return bgp_vty_return (vty, ret); | |
3401 | } | |
3402 | ||
3403 | DEFUN (neighbor_filter_list, | |
3404 | neighbor_filter_list_cmd, | |
3405 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
3406 | NEIGHBOR_STR | |
3407 | NEIGHBOR_ADDR_STR2 | |
3408 | "Establish BGP filters\n" | |
3409 | "AS path access-list name\n" | |
3410 | "Filter incoming routes\n" | |
3411 | "Filter outgoing routes\n") | |
3412 | { | |
3413 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3414 | bgp_node_safi (vty), argv[1], argv[2]); | |
3415 | } | |
3416 | ||
3417 | DEFUN (no_neighbor_filter_list, | |
3418 | no_neighbor_filter_list_cmd, | |
3419 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
3420 | NO_STR | |
3421 | NEIGHBOR_STR | |
3422 | NEIGHBOR_ADDR_STR2 | |
3423 | "Establish BGP filters\n" | |
3424 | "AS path access-list name\n" | |
3425 | "Filter incoming routes\n" | |
3426 | "Filter outgoing routes\n") | |
3427 | { | |
3428 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3429 | bgp_node_safi (vty), argv[2]); | |
3430 | } | |
3431 | \f | |
3432 | /* Set route-map to the peer. */ | |
3433 | int | |
fd79ac91 | 3434 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
3435 | afi_t afi, safi_t safi, | |
3436 | const char *name_str, const char *direct_str) | |
718e3744 | 3437 | { |
3438 | int ret; | |
3439 | struct peer *peer; | |
fee0f4c6 | 3440 | int direct = RMAP_IN; |
718e3744 | 3441 | |
3442 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3443 | if (! peer) | |
3444 | return CMD_WARNING; | |
3445 | ||
3446 | /* Check filter direction. */ | |
fee0f4c6 | 3447 | if (strncmp (direct_str, "in", 2) == 0) |
3448 | direct = RMAP_IN; | |
718e3744 | 3449 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 3450 | direct = RMAP_OUT; |
3451 | else if (strncmp (direct_str, "im", 2) == 0) | |
3452 | direct = RMAP_IMPORT; | |
3453 | else if (strncmp (direct_str, "e", 1) == 0) | |
3454 | direct = RMAP_EXPORT; | |
718e3744 | 3455 | |
3456 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
3457 | ||
3458 | return bgp_vty_return (vty, ret); | |
3459 | } | |
3460 | ||
3461 | int | |
fd79ac91 | 3462 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3463 | safi_t safi, const char *direct_str) | |
718e3744 | 3464 | { |
3465 | int ret; | |
3466 | struct peer *peer; | |
fee0f4c6 | 3467 | int direct = RMAP_IN; |
718e3744 | 3468 | |
3469 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3470 | if (! peer) | |
3471 | return CMD_WARNING; | |
3472 | ||
3473 | /* Check filter direction. */ | |
fee0f4c6 | 3474 | if (strncmp (direct_str, "in", 2) == 0) |
3475 | direct = RMAP_IN; | |
718e3744 | 3476 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 3477 | direct = RMAP_OUT; |
3478 | else if (strncmp (direct_str, "im", 2) == 0) | |
3479 | direct = RMAP_IMPORT; | |
3480 | else if (strncmp (direct_str, "e", 1) == 0) | |
3481 | direct = RMAP_EXPORT; | |
718e3744 | 3482 | |
3483 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
3484 | ||
3485 | return bgp_vty_return (vty, ret); | |
3486 | } | |
3487 | ||
3488 | DEFUN (neighbor_route_map, | |
3489 | neighbor_route_map_cmd, | |
fee0f4c6 | 3490 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 3491 | NEIGHBOR_STR |
3492 | NEIGHBOR_ADDR_STR2 | |
3493 | "Apply route map to neighbor\n" | |
3494 | "Name of route map\n" | |
3495 | "Apply map to incoming routes\n" | |
fee0f4c6 | 3496 | "Apply map to outbound routes\n" |
3497 | "Apply map to routes going into a Route-Server client's table\n" | |
3498 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 3499 | { |
3500 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3501 | bgp_node_safi (vty), argv[1], argv[2]); | |
3502 | } | |
3503 | ||
3504 | DEFUN (no_neighbor_route_map, | |
3505 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 3506 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 3507 | NO_STR |
3508 | NEIGHBOR_STR | |
3509 | NEIGHBOR_ADDR_STR2 | |
3510 | "Apply route map to neighbor\n" | |
3511 | "Name of route map\n" | |
3512 | "Apply map to incoming routes\n" | |
fee0f4c6 | 3513 | "Apply map to outbound routes\n" |
3514 | "Apply map to routes going into a Route-Server client's table\n" | |
3515 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 3516 | { |
3517 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3518 | bgp_node_safi (vty), argv[2]); | |
3519 | } | |
3520 | \f | |
3521 | /* Set unsuppress-map to the peer. */ | |
3522 | int | |
fd79ac91 | 3523 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3524 | safi_t safi, const char *name_str) | |
718e3744 | 3525 | { |
3526 | int ret; | |
3527 | struct peer *peer; | |
3528 | ||
3529 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3530 | if (! peer) | |
3531 | return CMD_WARNING; | |
3532 | ||
3533 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
3534 | ||
3535 | return bgp_vty_return (vty, ret); | |
3536 | } | |
3537 | ||
3538 | /* Unset route-map from the peer. */ | |
3539 | int | |
fd79ac91 | 3540 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 3541 | safi_t safi) |
3542 | { | |
3543 | int ret; | |
3544 | struct peer *peer; | |
3545 | ||
3546 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3547 | if (! peer) | |
3548 | return CMD_WARNING; | |
3549 | ||
3550 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
3551 | ||
3552 | return bgp_vty_return (vty, ret); | |
3553 | } | |
3554 | ||
3555 | DEFUN (neighbor_unsuppress_map, | |
3556 | neighbor_unsuppress_map_cmd, | |
3557 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
3558 | NEIGHBOR_STR | |
3559 | NEIGHBOR_ADDR_STR2 | |
3560 | "Route-map to selectively unsuppress suppressed routes\n" | |
3561 | "Name of route map\n") | |
3562 | { | |
3563 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3564 | bgp_node_safi (vty), argv[1]); | |
3565 | } | |
3566 | ||
3567 | DEFUN (no_neighbor_unsuppress_map, | |
3568 | no_neighbor_unsuppress_map_cmd, | |
3569 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
3570 | NO_STR | |
3571 | NEIGHBOR_STR | |
3572 | NEIGHBOR_ADDR_STR2 | |
3573 | "Route-map to selectively unsuppress suppressed routes\n" | |
3574 | "Name of route map\n") | |
3575 | { | |
3576 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3577 | bgp_node_safi (vty)); | |
3578 | } | |
3579 | \f | |
3580 | int | |
fd79ac91 | 3581 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3582 | safi_t safi, const char *num_str, | |
3583 | const char *threshold_str, int warning) | |
718e3744 | 3584 | { |
3585 | int ret; | |
3586 | struct peer *peer; | |
3587 | u_int32_t max; | |
e0701b79 | 3588 | u_char threshold; |
718e3744 | 3589 | |
3590 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3591 | if (! peer) | |
3592 | return CMD_WARNING; | |
3593 | ||
3594 | VTY_GET_INTEGER ("maxmum number", max, num_str); | |
e0701b79 | 3595 | if (threshold_str) |
3596 | threshold = atoi (threshold_str); | |
3597 | else | |
3598 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 3599 | |
e0701b79 | 3600 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning); |
718e3744 | 3601 | |
3602 | return bgp_vty_return (vty, ret); | |
3603 | } | |
3604 | ||
3605 | int | |
fd79ac91 | 3606 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 3607 | safi_t safi) |
3608 | { | |
3609 | int ret; | |
3610 | struct peer *peer; | |
3611 | ||
3612 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3613 | if (! peer) | |
3614 | return CMD_WARNING; | |
3615 | ||
3616 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
3617 | ||
3618 | return bgp_vty_return (vty, ret); | |
3619 | } | |
3620 | ||
3621 | /* Maximum number of prefix configuration. prefix count is different | |
3622 | for each peer configuration. So this configuration can be set for | |
3623 | each peer configuration. */ | |
3624 | DEFUN (neighbor_maximum_prefix, | |
3625 | neighbor_maximum_prefix_cmd, | |
3626 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
3627 | NEIGHBOR_STR | |
3628 | NEIGHBOR_ADDR_STR2 | |
3629 | "Maximum number of prefix accept from this peer\n" | |
3630 | "maximum no. of prefix limit\n") | |
3631 | { | |
3632 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
e0701b79 | 3633 | bgp_node_safi (vty), argv[1], NULL, 0); |
718e3744 | 3634 | } |
3635 | ||
e0701b79 | 3636 | DEFUN (neighbor_maximum_prefix_threshold, |
3637 | neighbor_maximum_prefix_threshold_cmd, | |
3638 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
3639 | NEIGHBOR_STR | |
3640 | NEIGHBOR_ADDR_STR2 | |
3641 | "Maximum number of prefix accept from this peer\n" | |
3642 | "maximum no. of prefix limit\n" | |
3643 | "Threshold value (%) at which to generate a warning msg\n") | |
3644 | { | |
3645 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3646 | bgp_node_safi (vty), argv[1], argv[2], 0); | |
3647 | } | |
3648 | ||
718e3744 | 3649 | DEFUN (neighbor_maximum_prefix_warning, |
3650 | neighbor_maximum_prefix_warning_cmd, | |
3651 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
3652 | NEIGHBOR_STR | |
3653 | NEIGHBOR_ADDR_STR2 | |
3654 | "Maximum number of prefix accept from this peer\n" | |
3655 | "maximum no. of prefix limit\n" | |
3656 | "Only give warning message when limit is exceeded\n") | |
3657 | { | |
3658 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
e0701b79 | 3659 | bgp_node_safi (vty), argv[1], NULL, 1); |
718e3744 | 3660 | } |
3661 | ||
e0701b79 | 3662 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
3663 | neighbor_maximum_prefix_threshold_warning_cmd, | |
3664 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
3665 | NEIGHBOR_STR | |
3666 | NEIGHBOR_ADDR_STR2 | |
3667 | "Maximum number of prefix accept from this peer\n" | |
3668 | "maximum no. of prefix limit\n" | |
3669 | "Threshold value (%) at which to generate a warning msg\n" | |
3670 | "Only give warning message when limit is exceeded\n") | |
3671 | { | |
3672 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3673 | bgp_node_safi (vty), argv[1], argv[2], 1); | |
3674 | } | |
3675 | ||
718e3744 | 3676 | DEFUN (no_neighbor_maximum_prefix, |
3677 | no_neighbor_maximum_prefix_cmd, | |
3678 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
3679 | NO_STR | |
3680 | NEIGHBOR_STR | |
3681 | NEIGHBOR_ADDR_STR2 | |
3682 | "Maximum number of prefix accept from this peer\n") | |
3683 | { | |
3684 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3685 | bgp_node_safi (vty)); | |
3686 | } | |
3687 | ||
3688 | ALIAS (no_neighbor_maximum_prefix, | |
3689 | no_neighbor_maximum_prefix_val_cmd, | |
3690 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
3691 | NO_STR | |
3692 | NEIGHBOR_STR | |
3693 | NEIGHBOR_ADDR_STR2 | |
3694 | "Maximum number of prefix accept from this peer\n" | |
3695 | "maximum no. of prefix limit\n") | |
3696 | ||
3697 | ALIAS (no_neighbor_maximum_prefix, | |
3698 | no_neighbor_maximum_prefix_val2_cmd, | |
e0701b79 | 3699 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
3700 | NO_STR | |
3701 | NEIGHBOR_STR | |
3702 | NEIGHBOR_ADDR_STR2 | |
3703 | "Maximum number of prefix accept from this peer\n" | |
3704 | "maximum no. of prefix limit\n" | |
3705 | "Threshold value (%) at which to generate a warning msg\n" | |
3706 | "Only give warning message when limit is exceeded\n") | |
3707 | ||
3708 | ALIAS (no_neighbor_maximum_prefix, | |
3709 | no_neighbor_maximum_prefix_val3_cmd, | |
718e3744 | 3710 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", |
3711 | NO_STR | |
3712 | NEIGHBOR_STR | |
3713 | NEIGHBOR_ADDR_STR2 | |
3714 | "Maximum number of prefix accept from this peer\n" | |
3715 | "maximum no. of prefix limit\n" | |
3716 | "Only give warning message when limit is exceeded\n") | |
3717 | \f | |
3718 | /* "neighbor allowas-in" */ | |
3719 | DEFUN (neighbor_allowas_in, | |
3720 | neighbor_allowas_in_cmd, | |
3721 | NEIGHBOR_CMD2 "allowas-in", | |
3722 | NEIGHBOR_STR | |
3723 | NEIGHBOR_ADDR_STR2 | |
3724 | "Accept as-path with my AS present in it\n") | |
3725 | { | |
3726 | int ret; | |
3727 | struct peer *peer; | |
fd79ac91 | 3728 | unsigned int allow_num; |
718e3744 | 3729 | |
3730 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3731 | if (! peer) | |
3732 | return CMD_WARNING; | |
3733 | ||
3734 | if (argc == 1) | |
3735 | allow_num = 3; | |
3736 | else | |
3737 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
3738 | ||
3739 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
3740 | allow_num); | |
3741 | ||
3742 | return bgp_vty_return (vty, ret); | |
3743 | } | |
3744 | ||
3745 | ALIAS (neighbor_allowas_in, | |
3746 | neighbor_allowas_in_arg_cmd, | |
3747 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
3748 | NEIGHBOR_STR | |
3749 | NEIGHBOR_ADDR_STR2 | |
3750 | "Accept as-path with my AS present in it\n" | |
3751 | "Number of occurances of AS number\n") | |
3752 | ||
3753 | DEFUN (no_neighbor_allowas_in, | |
3754 | no_neighbor_allowas_in_cmd, | |
3755 | NO_NEIGHBOR_CMD2 "allowas-in", | |
3756 | NO_STR | |
3757 | NEIGHBOR_STR | |
3758 | NEIGHBOR_ADDR_STR2 | |
3759 | "allow local ASN appears in aspath attribute\n") | |
3760 | { | |
3761 | int ret; | |
3762 | struct peer *peer; | |
3763 | ||
3764 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3765 | if (! peer) | |
3766 | return CMD_WARNING; | |
3767 | ||
3768 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3769 | ||
3770 | return bgp_vty_return (vty, ret); | |
3771 | } | |
3772 | \f | |
3773 | /* Address family configuration. */ | |
3774 | DEFUN (address_family_ipv4, | |
3775 | address_family_ipv4_cmd, | |
3776 | "address-family ipv4", | |
3777 | "Enter Address Family command mode\n" | |
3778 | "Address family\n") | |
3779 | { | |
3780 | vty->node = BGP_IPV4_NODE; | |
3781 | return CMD_SUCCESS; | |
3782 | } | |
3783 | ||
3784 | DEFUN (address_family_ipv4_safi, | |
3785 | address_family_ipv4_safi_cmd, | |
3786 | "address-family ipv4 (unicast|multicast)", | |
3787 | "Enter Address Family command mode\n" | |
3788 | "Address family\n" | |
3789 | "Address Family modifier\n" | |
3790 | "Address Family modifier\n") | |
3791 | { | |
3792 | if (strncmp (argv[0], "m", 1) == 0) | |
3793 | vty->node = BGP_IPV4M_NODE; | |
3794 | else | |
3795 | vty->node = BGP_IPV4_NODE; | |
3796 | ||
3797 | return CMD_SUCCESS; | |
3798 | } | |
3799 | ||
3800 | DEFUN (address_family_ipv6_unicast, | |
3801 | address_family_ipv6_unicast_cmd, | |
3802 | "address-family ipv6 unicast", | |
3803 | "Enter Address Family command mode\n" | |
3804 | "Address family\n" | |
3805 | "unicast\n") | |
3806 | { | |
3807 | vty->node = BGP_IPV6_NODE; | |
3808 | return CMD_SUCCESS; | |
3809 | } | |
3810 | ||
3811 | ALIAS (address_family_ipv6_unicast, | |
3812 | address_family_ipv6_cmd, | |
3813 | "address-family ipv6", | |
3814 | "Enter Address Family command mode\n" | |
3815 | "Address family\n") | |
3816 | ||
3817 | DEFUN (address_family_vpnv4, | |
3818 | address_family_vpnv4_cmd, | |
3819 | "address-family vpnv4", | |
3820 | "Enter Address Family command mode\n" | |
3821 | "Address family\n") | |
3822 | { | |
3823 | vty->node = BGP_VPNV4_NODE; | |
3824 | return CMD_SUCCESS; | |
3825 | } | |
3826 | ||
3827 | ALIAS (address_family_vpnv4, | |
3828 | address_family_vpnv4_unicast_cmd, | |
3829 | "address-family vpnv4 unicast", | |
3830 | "Enter Address Family command mode\n" | |
3831 | "Address family\n" | |
3832 | "Address Family Modifier\n") | |
3833 | ||
3834 | DEFUN (exit_address_family, | |
3835 | exit_address_family_cmd, | |
3836 | "exit-address-family", | |
3837 | "Exit from Address Family configuration mode\n") | |
3838 | { | |
3839 | if (vty->node == BGP_IPV4M_NODE | |
3840 | || vty->node == BGP_VPNV4_NODE | |
3841 | || vty->node == BGP_IPV6_NODE) | |
3842 | vty->node = BGP_NODE; | |
3843 | return CMD_SUCCESS; | |
3844 | } | |
3845 | \f | |
3846 | /* BGP clear sort. */ | |
3847 | enum clear_sort | |
3848 | { | |
3849 | clear_all, | |
3850 | clear_peer, | |
3851 | clear_group, | |
3852 | clear_external, | |
3853 | clear_as | |
3854 | }; | |
3855 | ||
3856 | void | |
3857 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
3858 | safi_t safi, int error) | |
3859 | { | |
3860 | switch (error) | |
3861 | { | |
3862 | case BGP_ERR_AF_UNCONFIGURED: | |
3863 | vty_out (vty, | |
3864 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
3865 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
3866 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
3867 | peer->host, VTY_NEWLINE); | |
3868 | break; | |
3869 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
3870 | 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); | |
3871 | break; | |
3872 | default: | |
3873 | break; | |
3874 | } | |
3875 | } | |
3876 | ||
3877 | /* `clear ip bgp' functions. */ | |
3878 | int | |
3879 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
fd79ac91 | 3880 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
718e3744 | 3881 | { |
3882 | int ret; | |
3883 | struct peer *peer; | |
3884 | struct listnode *nn; | |
3885 | ||
3886 | /* Clear all neighbors. */ | |
3887 | if (sort == clear_all) | |
3888 | { | |
3889 | LIST_LOOP (bgp->peer, peer, nn) | |
3890 | { | |
3891 | if (stype == BGP_CLEAR_SOFT_NONE) | |
3892 | ret = peer_clear (peer); | |
3893 | else | |
3894 | ret = peer_clear_soft (peer, afi, safi, stype); | |
3895 | ||
3896 | if (ret < 0) | |
3897 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
3898 | } | |
3899 | return 0; | |
3900 | } | |
3901 | ||
3902 | /* Clear specified neighbors. */ | |
3903 | if (sort == clear_peer) | |
3904 | { | |
3905 | union sockunion su; | |
3906 | int ret; | |
3907 | ||
3908 | /* Make sockunion for lookup. */ | |
3909 | ret = str2sockunion (arg, &su); | |
3910 | if (ret < 0) | |
3911 | { | |
3912 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); | |
3913 | return -1; | |
3914 | } | |
3915 | peer = peer_lookup (bgp, &su); | |
3916 | if (! peer) | |
3917 | { | |
3918 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
3919 | return -1; | |
3920 | } | |
3921 | ||
3922 | if (stype == BGP_CLEAR_SOFT_NONE) | |
3923 | ret = peer_clear (peer); | |
3924 | else | |
3925 | ret = peer_clear_soft (peer, afi, safi, stype); | |
3926 | ||
3927 | if (ret < 0) | |
3928 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
3929 | ||
3930 | return 0; | |
3931 | } | |
3932 | ||
3933 | /* Clear all peer-group members. */ | |
3934 | if (sort == clear_group) | |
3935 | { | |
3936 | struct peer_group *group; | |
3937 | ||
3938 | group = peer_group_lookup (bgp, arg); | |
3939 | if (! group) | |
3940 | { | |
3941 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
3942 | return -1; | |
3943 | } | |
3944 | ||
3945 | LIST_LOOP (group->peer, peer, nn) | |
3946 | { | |
3947 | if (stype == BGP_CLEAR_SOFT_NONE) | |
3948 | { | |
3949 | ret = peer_clear (peer); | |
3950 | continue; | |
3951 | } | |
3952 | ||
3953 | if (! peer->af_group[afi][safi]) | |
3954 | continue; | |
3955 | ||
3956 | ret = peer_clear_soft (peer, afi, safi, stype); | |
3957 | ||
3958 | if (ret < 0) | |
3959 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
3960 | } | |
3961 | return 0; | |
3962 | } | |
3963 | ||
3964 | if (sort == clear_external) | |
3965 | { | |
3966 | LIST_LOOP (bgp->peer, peer, nn) | |
3967 | { | |
3968 | if (peer_sort (peer) == BGP_PEER_IBGP) | |
3969 | continue; | |
3970 | ||
3971 | if (stype == BGP_CLEAR_SOFT_NONE) | |
3972 | ret = peer_clear (peer); | |
3973 | else | |
3974 | ret = peer_clear_soft (peer, afi, safi, stype); | |
3975 | ||
3976 | if (ret < 0) | |
3977 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
3978 | } | |
3979 | return 0; | |
3980 | } | |
3981 | ||
3982 | if (sort == clear_as) | |
3983 | { | |
3984 | as_t as; | |
3985 | unsigned long as_ul; | |
3986 | char *endptr = NULL; | |
3987 | int find = 0; | |
3988 | ||
3989 | as_ul = strtoul(arg, &endptr, 10); | |
3990 | ||
3991 | if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX)) | |
3992 | { | |
3993 | vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); | |
3994 | return -1; | |
3995 | } | |
3996 | as = (as_t) as_ul; | |
3997 | ||
3998 | LIST_LOOP (bgp->peer, peer, nn) | |
3999 | { | |
4000 | if (peer->as != as) | |
4001 | continue; | |
4002 | ||
4003 | find = 1; | |
4004 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4005 | ret = peer_clear (peer); | |
4006 | else | |
4007 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4008 | ||
4009 | if (ret < 0) | |
4010 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4011 | } | |
4012 | if (! find) | |
4013 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
4014 | VTY_NEWLINE); | |
4015 | return 0; | |
4016 | } | |
4017 | ||
4018 | return 0; | |
4019 | } | |
4020 | ||
4021 | int | |
fd79ac91 | 4022 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
4023 | enum clear_sort sort, enum bgp_clear_type stype, | |
4024 | const char *arg) | |
718e3744 | 4025 | { |
4026 | int ret; | |
4027 | struct bgp *bgp; | |
4028 | ||
4029 | /* BGP structure lookup. */ | |
4030 | if (name) | |
4031 | { | |
4032 | bgp = bgp_lookup_by_name (name); | |
4033 | if (bgp == NULL) | |
4034 | { | |
4035 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
4036 | return CMD_WARNING; | |
4037 | } | |
4038 | } | |
4039 | else | |
4040 | { | |
4041 | bgp = bgp_get_default (); | |
4042 | if (bgp == NULL) | |
4043 | { | |
4044 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
4045 | return CMD_WARNING; | |
4046 | } | |
4047 | } | |
4048 | ||
4049 | ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
4050 | if (ret < 0) | |
4051 | return CMD_WARNING; | |
4052 | ||
4053 | return CMD_SUCCESS; | |
4054 | } | |
4055 | ||
4056 | DEFUN (clear_ip_bgp_all, | |
4057 | clear_ip_bgp_all_cmd, | |
4058 | "clear ip bgp *", | |
4059 | CLEAR_STR | |
4060 | IP_STR | |
4061 | BGP_STR | |
4062 | "Clear all peers\n") | |
4063 | { | |
4064 | if (argc == 1) | |
4065 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4066 | ||
4067 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4068 | } | |
4069 | ||
4070 | ALIAS (clear_ip_bgp_all, | |
4071 | clear_bgp_all_cmd, | |
4072 | "clear bgp *", | |
4073 | CLEAR_STR | |
4074 | BGP_STR | |
4075 | "Clear all peers\n") | |
4076 | ||
4077 | ALIAS (clear_ip_bgp_all, | |
4078 | clear_bgp_ipv6_all_cmd, | |
4079 | "clear bgp ipv6 *", | |
4080 | CLEAR_STR | |
4081 | BGP_STR | |
4082 | "Address family\n" | |
4083 | "Clear all peers\n") | |
4084 | ||
4085 | ALIAS (clear_ip_bgp_all, | |
4086 | clear_ip_bgp_instance_all_cmd, | |
4087 | "clear ip bgp view WORD *", | |
4088 | CLEAR_STR | |
4089 | IP_STR | |
4090 | BGP_STR | |
4091 | "BGP view\n" | |
4092 | "view name\n" | |
4093 | "Clear all peers\n") | |
4094 | ||
4095 | ALIAS (clear_ip_bgp_all, | |
4096 | clear_bgp_instance_all_cmd, | |
4097 | "clear bgp view WORD *", | |
4098 | CLEAR_STR | |
4099 | BGP_STR | |
4100 | "BGP view\n" | |
4101 | "view name\n" | |
4102 | "Clear all peers\n") | |
4103 | ||
4104 | DEFUN (clear_ip_bgp_peer, | |
4105 | clear_ip_bgp_peer_cmd, | |
4106 | "clear ip bgp (A.B.C.D|X:X::X:X)", | |
4107 | CLEAR_STR | |
4108 | IP_STR | |
4109 | BGP_STR | |
4110 | "BGP neighbor IP address to clear\n" | |
4111 | "BGP IPv6 neighbor to clear\n") | |
4112 | { | |
4113 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4114 | } | |
4115 | ||
4116 | ALIAS (clear_ip_bgp_peer, | |
4117 | clear_bgp_peer_cmd, | |
4118 | "clear bgp (A.B.C.D|X:X::X:X)", | |
4119 | CLEAR_STR | |
4120 | BGP_STR | |
4121 | "BGP neighbor address to clear\n" | |
4122 | "BGP IPv6 neighbor to clear\n") | |
4123 | ||
4124 | ALIAS (clear_ip_bgp_peer, | |
4125 | clear_bgp_ipv6_peer_cmd, | |
4126 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", | |
4127 | CLEAR_STR | |
4128 | BGP_STR | |
4129 | "Address family\n" | |
4130 | "BGP neighbor address to clear\n" | |
4131 | "BGP IPv6 neighbor to clear\n") | |
4132 | ||
4133 | DEFUN (clear_ip_bgp_peer_group, | |
4134 | clear_ip_bgp_peer_group_cmd, | |
4135 | "clear ip bgp peer-group WORD", | |
4136 | CLEAR_STR | |
4137 | IP_STR | |
4138 | BGP_STR | |
4139 | "Clear all members of peer-group\n" | |
4140 | "BGP peer-group name\n") | |
4141 | { | |
4142 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4143 | } | |
4144 | ||
4145 | ALIAS (clear_ip_bgp_peer_group, | |
4146 | clear_bgp_peer_group_cmd, | |
4147 | "clear bgp peer-group WORD", | |
4148 | CLEAR_STR | |
4149 | BGP_STR | |
4150 | "Clear all members of peer-group\n" | |
4151 | "BGP peer-group name\n") | |
4152 | ||
4153 | ALIAS (clear_ip_bgp_peer_group, | |
4154 | clear_bgp_ipv6_peer_group_cmd, | |
4155 | "clear bgp ipv6 peer-group WORD", | |
4156 | CLEAR_STR | |
4157 | BGP_STR | |
4158 | "Address family\n" | |
4159 | "Clear all members of peer-group\n" | |
4160 | "BGP peer-group name\n") | |
4161 | ||
4162 | DEFUN (clear_ip_bgp_external, | |
4163 | clear_ip_bgp_external_cmd, | |
4164 | "clear ip bgp external", | |
4165 | CLEAR_STR | |
4166 | IP_STR | |
4167 | BGP_STR | |
4168 | "Clear all external peers\n") | |
4169 | { | |
4170 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
4171 | } | |
4172 | ||
4173 | ALIAS (clear_ip_bgp_external, | |
4174 | clear_bgp_external_cmd, | |
4175 | "clear bgp external", | |
4176 | CLEAR_STR | |
4177 | BGP_STR | |
4178 | "Clear all external peers\n") | |
4179 | ||
4180 | ALIAS (clear_ip_bgp_external, | |
4181 | clear_bgp_ipv6_external_cmd, | |
4182 | "clear bgp ipv6 external", | |
4183 | CLEAR_STR | |
4184 | BGP_STR | |
4185 | "Address family\n" | |
4186 | "Clear all external peers\n") | |
4187 | ||
4188 | DEFUN (clear_ip_bgp_as, | |
4189 | clear_ip_bgp_as_cmd, | |
4190 | "clear ip bgp <1-65535>", | |
4191 | CLEAR_STR | |
4192 | IP_STR | |
4193 | BGP_STR | |
4194 | "Clear peers with the AS number\n") | |
4195 | { | |
4196 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4197 | } | |
4198 | ||
4199 | ALIAS (clear_ip_bgp_as, | |
4200 | clear_bgp_as_cmd, | |
4201 | "clear bgp <1-65535>", | |
4202 | CLEAR_STR | |
4203 | BGP_STR | |
4204 | "Clear peers with the AS number\n") | |
4205 | ||
4206 | ALIAS (clear_ip_bgp_as, | |
4207 | clear_bgp_ipv6_as_cmd, | |
4208 | "clear bgp ipv6 <1-65535>", | |
4209 | CLEAR_STR | |
4210 | BGP_STR | |
4211 | "Address family\n" | |
4212 | "Clear peers with the AS number\n") | |
4213 | \f | |
4214 | /* Outbound soft-reconfiguration */ | |
4215 | DEFUN (clear_ip_bgp_all_soft_out, | |
4216 | clear_ip_bgp_all_soft_out_cmd, | |
4217 | "clear ip bgp * soft out", | |
4218 | CLEAR_STR | |
4219 | IP_STR | |
4220 | BGP_STR | |
4221 | "Clear all peers\n" | |
4222 | "Soft reconfig\n" | |
4223 | "Soft reconfig outbound update\n") | |
4224 | { | |
4225 | if (argc == 1) | |
4226 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4227 | BGP_CLEAR_SOFT_OUT, NULL); | |
4228 | ||
4229 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4230 | BGP_CLEAR_SOFT_OUT, NULL); | |
4231 | } | |
4232 | ||
4233 | ALIAS (clear_ip_bgp_all_soft_out, | |
4234 | clear_ip_bgp_all_out_cmd, | |
4235 | "clear ip bgp * out", | |
4236 | CLEAR_STR | |
4237 | IP_STR | |
4238 | BGP_STR | |
4239 | "Clear all peers\n" | |
4240 | "Soft reconfig outbound update\n") | |
4241 | ||
4242 | ALIAS (clear_ip_bgp_all_soft_out, | |
4243 | clear_ip_bgp_instance_all_soft_out_cmd, | |
4244 | "clear ip bgp view WORD * soft out", | |
4245 | CLEAR_STR | |
4246 | IP_STR | |
4247 | BGP_STR | |
4248 | "BGP view\n" | |
4249 | "view name\n" | |
4250 | "Clear all peers\n" | |
4251 | "Soft reconfig\n" | |
4252 | "Soft reconfig outbound update\n") | |
4253 | ||
4254 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
4255 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
4256 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
4257 | CLEAR_STR | |
4258 | IP_STR | |
4259 | BGP_STR | |
4260 | "Clear all peers\n" | |
4261 | "Address family\n" | |
4262 | "Address Family modifier\n" | |
4263 | "Address Family modifier\n" | |
4264 | "Soft reconfig\n" | |
4265 | "Soft reconfig outbound update\n") | |
4266 | { | |
4267 | if (strncmp (argv[0], "m", 1) == 0) | |
4268 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
4269 | BGP_CLEAR_SOFT_OUT, NULL); | |
4270 | ||
4271 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4272 | BGP_CLEAR_SOFT_OUT, NULL); | |
4273 | } | |
4274 | ||
4275 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
4276 | clear_ip_bgp_all_ipv4_out_cmd, | |
4277 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
4278 | CLEAR_STR | |
4279 | IP_STR | |
4280 | BGP_STR | |
4281 | "Clear all peers\n" | |
4282 | "Address family\n" | |
4283 | "Address Family modifier\n" | |
4284 | "Address Family modifier\n" | |
4285 | "Soft reconfig outbound update\n") | |
4286 | ||
4287 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
4288 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
4289 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
4290 | CLEAR_STR | |
4291 | IP_STR | |
4292 | BGP_STR | |
4293 | "BGP view\n" | |
4294 | "view name\n" | |
4295 | "Clear all peers\n" | |
4296 | "Address family\n" | |
4297 | "Address Family modifier\n" | |
4298 | "Address Family modifier\n" | |
4299 | "Soft reconfig outbound update\n") | |
4300 | { | |
4301 | if (strncmp (argv[1], "m", 1) == 0) | |
4302 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
4303 | BGP_CLEAR_SOFT_OUT, NULL); | |
4304 | ||
4305 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4306 | BGP_CLEAR_SOFT_OUT, NULL); | |
4307 | } | |
4308 | ||
4309 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
4310 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
4311 | "clear ip bgp * vpnv4 unicast soft out", | |
4312 | CLEAR_STR | |
4313 | IP_STR | |
4314 | BGP_STR | |
4315 | "Clear all peers\n" | |
4316 | "Address family\n" | |
4317 | "Address Family Modifier\n" | |
4318 | "Soft reconfig\n" | |
4319 | "Soft reconfig outbound update\n") | |
4320 | { | |
4321 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
4322 | BGP_CLEAR_SOFT_OUT, NULL); | |
4323 | } | |
4324 | ||
4325 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
4326 | clear_ip_bgp_all_vpnv4_out_cmd, | |
4327 | "clear ip bgp * vpnv4 unicast out", | |
4328 | CLEAR_STR | |
4329 | IP_STR | |
4330 | BGP_STR | |
4331 | "Clear all peers\n" | |
4332 | "Address family\n" | |
4333 | "Address Family Modifier\n" | |
4334 | "Soft reconfig outbound update\n") | |
4335 | ||
4336 | DEFUN (clear_bgp_all_soft_out, | |
4337 | clear_bgp_all_soft_out_cmd, | |
4338 | "clear bgp * soft out", | |
4339 | CLEAR_STR | |
4340 | BGP_STR | |
4341 | "Clear all peers\n" | |
4342 | "Soft reconfig\n" | |
4343 | "Soft reconfig outbound update\n") | |
4344 | { | |
4345 | if (argc == 1) | |
4346 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
4347 | BGP_CLEAR_SOFT_OUT, NULL); | |
4348 | ||
4349 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
4350 | BGP_CLEAR_SOFT_OUT, NULL); | |
4351 | } | |
4352 | ||
4353 | ALIAS (clear_bgp_all_soft_out, | |
4354 | clear_bgp_instance_all_soft_out_cmd, | |
4355 | "clear bgp view WORD * soft out", | |
4356 | CLEAR_STR | |
4357 | BGP_STR | |
4358 | "BGP view\n" | |
4359 | "view name\n" | |
4360 | "Clear all peers\n" | |
4361 | "Soft reconfig\n" | |
4362 | "Soft reconfig outbound update\n") | |
4363 | ||
4364 | ALIAS (clear_bgp_all_soft_out, | |
4365 | clear_bgp_all_out_cmd, | |
4366 | "clear bgp * out", | |
4367 | CLEAR_STR | |
4368 | BGP_STR | |
4369 | "Clear all peers\n" | |
4370 | "Soft reconfig outbound update\n") | |
4371 | ||
4372 | ALIAS (clear_bgp_all_soft_out, | |
4373 | clear_bgp_ipv6_all_soft_out_cmd, | |
4374 | "clear bgp ipv6 * soft out", | |
4375 | CLEAR_STR | |
4376 | BGP_STR | |
4377 | "Address family\n" | |
4378 | "Clear all peers\n" | |
4379 | "Soft reconfig\n" | |
4380 | "Soft reconfig outbound update\n") | |
4381 | ||
4382 | ALIAS (clear_bgp_all_soft_out, | |
4383 | clear_bgp_ipv6_all_out_cmd, | |
4384 | "clear bgp ipv6 * out", | |
4385 | CLEAR_STR | |
4386 | BGP_STR | |
4387 | "Address family\n" | |
4388 | "Clear all peers\n" | |
4389 | "Soft reconfig outbound update\n") | |
4390 | ||
4391 | DEFUN (clear_ip_bgp_peer_soft_out, | |
4392 | clear_ip_bgp_peer_soft_out_cmd, | |
4393 | "clear ip bgp A.B.C.D soft out", | |
4394 | CLEAR_STR | |
4395 | IP_STR | |
4396 | BGP_STR | |
4397 | "BGP neighbor address to clear\n" | |
4398 | "Soft reconfig\n" | |
4399 | "Soft reconfig outbound update\n") | |
4400 | { | |
4401 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
4402 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4403 | } | |
4404 | ||
4405 | ALIAS (clear_ip_bgp_peer_soft_out, | |
4406 | clear_ip_bgp_peer_out_cmd, | |
4407 | "clear ip bgp A.B.C.D out", | |
4408 | CLEAR_STR | |
4409 | IP_STR | |
4410 | BGP_STR | |
4411 | "BGP neighbor address to clear\n" | |
4412 | "Soft reconfig outbound update\n") | |
4413 | ||
4414 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
4415 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
4416 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", | |
4417 | CLEAR_STR | |
4418 | IP_STR | |
4419 | BGP_STR | |
4420 | "BGP neighbor address to clear\n" | |
4421 | "Address family\n" | |
4422 | "Address Family modifier\n" | |
4423 | "Address Family modifier\n" | |
4424 | "Soft reconfig\n" | |
4425 | "Soft reconfig outbound update\n") | |
4426 | { | |
4427 | if (strncmp (argv[1], "m", 1) == 0) | |
4428 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
4429 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4430 | ||
4431 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
4432 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4433 | } | |
4434 | ||
4435 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
4436 | clear_ip_bgp_peer_ipv4_out_cmd, | |
4437 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", | |
4438 | CLEAR_STR | |
4439 | IP_STR | |
4440 | BGP_STR | |
4441 | "BGP neighbor address to clear\n" | |
4442 | "Address family\n" | |
4443 | "Address Family modifier\n" | |
4444 | "Address Family modifier\n" | |
4445 | "Soft reconfig outbound update\n") | |
4446 | ||
4447 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, | |
4448 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
4449 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", | |
4450 | CLEAR_STR | |
4451 | IP_STR | |
4452 | BGP_STR | |
4453 | "BGP neighbor address to clear\n" | |
4454 | "Address family\n" | |
4455 | "Address Family Modifier\n" | |
4456 | "Soft reconfig\n" | |
4457 | "Soft reconfig outbound update\n") | |
4458 | { | |
4459 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
4460 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4461 | } | |
4462 | ||
4463 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
4464 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
4465 | "clear ip bgp A.B.C.D vpnv4 unicast out", | |
4466 | CLEAR_STR | |
4467 | IP_STR | |
4468 | BGP_STR | |
4469 | "BGP neighbor address to clear\n" | |
4470 | "Address family\n" | |
4471 | "Address Family Modifier\n" | |
4472 | "Soft reconfig outbound update\n") | |
4473 | ||
4474 | DEFUN (clear_bgp_peer_soft_out, | |
4475 | clear_bgp_peer_soft_out_cmd, | |
4476 | "clear bgp (A.B.C.D|X:X::X:X) soft out", | |
4477 | CLEAR_STR | |
4478 | BGP_STR | |
4479 | "BGP neighbor address to clear\n" | |
4480 | "BGP IPv6 neighbor to clear\n" | |
4481 | "Soft reconfig\n" | |
4482 | "Soft reconfig outbound update\n") | |
4483 | { | |
4484 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
4485 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4486 | } | |
4487 | ||
4488 | ALIAS (clear_bgp_peer_soft_out, | |
4489 | clear_bgp_ipv6_peer_soft_out_cmd, | |
4490 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", | |
4491 | CLEAR_STR | |
4492 | BGP_STR | |
4493 | "Address family\n" | |
4494 | "BGP neighbor address to clear\n" | |
4495 | "BGP IPv6 neighbor to clear\n" | |
4496 | "Soft reconfig\n" | |
4497 | "Soft reconfig outbound update\n") | |
4498 | ||
4499 | ALIAS (clear_bgp_peer_soft_out, | |
4500 | clear_bgp_peer_out_cmd, | |
4501 | "clear bgp (A.B.C.D|X:X::X:X) out", | |
4502 | CLEAR_STR | |
4503 | BGP_STR | |
4504 | "BGP neighbor address to clear\n" | |
4505 | "BGP IPv6 neighbor to clear\n" | |
4506 | "Soft reconfig outbound update\n") | |
4507 | ||
4508 | ALIAS (clear_bgp_peer_soft_out, | |
4509 | clear_bgp_ipv6_peer_out_cmd, | |
4510 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", | |
4511 | CLEAR_STR | |
4512 | BGP_STR | |
4513 | "Address family\n" | |
4514 | "BGP neighbor address to clear\n" | |
4515 | "BGP IPv6 neighbor to clear\n" | |
4516 | "Soft reconfig outbound update\n") | |
4517 | ||
4518 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
4519 | clear_ip_bgp_peer_group_soft_out_cmd, | |
4520 | "clear ip bgp peer-group WORD soft out", | |
4521 | CLEAR_STR | |
4522 | IP_STR | |
4523 | BGP_STR | |
4524 | "Clear all members of peer-group\n" | |
4525 | "BGP peer-group name\n" | |
4526 | "Soft reconfig\n" | |
4527 | "Soft reconfig outbound update\n") | |
4528 | { | |
4529 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
4530 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4531 | } | |
4532 | ||
4533 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
4534 | clear_ip_bgp_peer_group_out_cmd, | |
4535 | "clear ip bgp peer-group WORD out", | |
4536 | CLEAR_STR | |
4537 | IP_STR | |
4538 | BGP_STR | |
4539 | "Clear all members of peer-group\n" | |
4540 | "BGP peer-group name\n" | |
4541 | "Soft reconfig outbound update\n") | |
4542 | ||
4543 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
4544 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
4545 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
4546 | CLEAR_STR | |
4547 | IP_STR | |
4548 | BGP_STR | |
4549 | "Clear all members of peer-group\n" | |
4550 | "BGP peer-group name\n" | |
4551 | "Address family\n" | |
4552 | "Address Family modifier\n" | |
4553 | "Address Family modifier\n" | |
4554 | "Soft reconfig\n" | |
4555 | "Soft reconfig outbound update\n") | |
4556 | { | |
4557 | if (strncmp (argv[1], "m", 1) == 0) | |
4558 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
4559 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4560 | ||
4561 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
4562 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4563 | } | |
4564 | ||
4565 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
4566 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
4567 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
4568 | CLEAR_STR | |
4569 | IP_STR | |
4570 | BGP_STR | |
4571 | "Clear all members of peer-group\n" | |
4572 | "BGP peer-group name\n" | |
4573 | "Address family\n" | |
4574 | "Address Family modifier\n" | |
4575 | "Address Family modifier\n" | |
4576 | "Soft reconfig outbound update\n") | |
4577 | ||
4578 | DEFUN (clear_bgp_peer_group_soft_out, | |
4579 | clear_bgp_peer_group_soft_out_cmd, | |
4580 | "clear bgp peer-group WORD soft out", | |
4581 | CLEAR_STR | |
4582 | BGP_STR | |
4583 | "Clear all members of peer-group\n" | |
4584 | "BGP peer-group name\n" | |
4585 | "Soft reconfig\n" | |
4586 | "Soft reconfig outbound update\n") | |
4587 | { | |
4588 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
4589 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4590 | } | |
4591 | ||
4592 | ALIAS (clear_bgp_peer_group_soft_out, | |
4593 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
4594 | "clear bgp ipv6 peer-group WORD soft out", | |
4595 | CLEAR_STR | |
4596 | BGP_STR | |
4597 | "Address family\n" | |
4598 | "Clear all members of peer-group\n" | |
4599 | "BGP peer-group name\n" | |
4600 | "Soft reconfig\n" | |
4601 | "Soft reconfig outbound update\n") | |
4602 | ||
4603 | ALIAS (clear_bgp_peer_group_soft_out, | |
4604 | clear_bgp_peer_group_out_cmd, | |
4605 | "clear bgp peer-group WORD out", | |
4606 | CLEAR_STR | |
4607 | BGP_STR | |
4608 | "Clear all members of peer-group\n" | |
4609 | "BGP peer-group name\n" | |
4610 | "Soft reconfig outbound update\n") | |
4611 | ||
4612 | ALIAS (clear_bgp_peer_group_soft_out, | |
4613 | clear_bgp_ipv6_peer_group_out_cmd, | |
4614 | "clear bgp ipv6 peer-group WORD out", | |
4615 | CLEAR_STR | |
4616 | BGP_STR | |
4617 | "Address family\n" | |
4618 | "Clear all members of peer-group\n" | |
4619 | "BGP peer-group name\n" | |
4620 | "Soft reconfig outbound update\n") | |
4621 | ||
4622 | DEFUN (clear_ip_bgp_external_soft_out, | |
4623 | clear_ip_bgp_external_soft_out_cmd, | |
4624 | "clear ip bgp external soft out", | |
4625 | CLEAR_STR | |
4626 | IP_STR | |
4627 | BGP_STR | |
4628 | "Clear all external peers\n" | |
4629 | "Soft reconfig\n" | |
4630 | "Soft reconfig outbound update\n") | |
4631 | { | |
4632 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
4633 | BGP_CLEAR_SOFT_OUT, NULL); | |
4634 | } | |
4635 | ||
4636 | ALIAS (clear_ip_bgp_external_soft_out, | |
4637 | clear_ip_bgp_external_out_cmd, | |
4638 | "clear ip bgp external out", | |
4639 | CLEAR_STR | |
4640 | IP_STR | |
4641 | BGP_STR | |
4642 | "Clear all external peers\n" | |
4643 | "Soft reconfig outbound update\n") | |
4644 | ||
4645 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
4646 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
4647 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
4648 | CLEAR_STR | |
4649 | IP_STR | |
4650 | BGP_STR | |
4651 | "Clear all external peers\n" | |
4652 | "Address family\n" | |
4653 | "Address Family modifier\n" | |
4654 | "Address Family modifier\n" | |
4655 | "Soft reconfig\n" | |
4656 | "Soft reconfig outbound update\n") | |
4657 | { | |
4658 | if (strncmp (argv[0], "m", 1) == 0) | |
4659 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
4660 | BGP_CLEAR_SOFT_OUT, NULL); | |
4661 | ||
4662 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
4663 | BGP_CLEAR_SOFT_OUT, NULL); | |
4664 | } | |
4665 | ||
4666 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
4667 | clear_ip_bgp_external_ipv4_out_cmd, | |
4668 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
4669 | CLEAR_STR | |
4670 | IP_STR | |
4671 | BGP_STR | |
4672 | "Clear all external peers\n" | |
4673 | "Address family\n" | |
4674 | "Address Family modifier\n" | |
4675 | "Address Family modifier\n" | |
4676 | "Soft reconfig outbound update\n") | |
4677 | ||
4678 | DEFUN (clear_bgp_external_soft_out, | |
4679 | clear_bgp_external_soft_out_cmd, | |
4680 | "clear bgp external soft out", | |
4681 | CLEAR_STR | |
4682 | BGP_STR | |
4683 | "Clear all external peers\n" | |
4684 | "Soft reconfig\n" | |
4685 | "Soft reconfig outbound update\n") | |
4686 | { | |
4687 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
4688 | BGP_CLEAR_SOFT_OUT, NULL); | |
4689 | } | |
4690 | ||
4691 | ALIAS (clear_bgp_external_soft_out, | |
4692 | clear_bgp_ipv6_external_soft_out_cmd, | |
4693 | "clear bgp ipv6 external soft out", | |
4694 | CLEAR_STR | |
4695 | BGP_STR | |
4696 | "Address family\n" | |
4697 | "Clear all external peers\n" | |
4698 | "Soft reconfig\n" | |
4699 | "Soft reconfig outbound update\n") | |
4700 | ||
4701 | ALIAS (clear_bgp_external_soft_out, | |
4702 | clear_bgp_external_out_cmd, | |
4703 | "clear bgp external out", | |
4704 | CLEAR_STR | |
4705 | BGP_STR | |
4706 | "Clear all external peers\n" | |
4707 | "Soft reconfig outbound update\n") | |
4708 | ||
4709 | ALIAS (clear_bgp_external_soft_out, | |
4710 | clear_bgp_ipv6_external_out_cmd, | |
4711 | "clear bgp ipv6 external WORD out", | |
4712 | CLEAR_STR | |
4713 | BGP_STR | |
4714 | "Address family\n" | |
4715 | "Clear all external peers\n" | |
4716 | "Soft reconfig outbound update\n") | |
4717 | ||
4718 | DEFUN (clear_ip_bgp_as_soft_out, | |
4719 | clear_ip_bgp_as_soft_out_cmd, | |
4720 | "clear ip bgp <1-65535> soft out", | |
4721 | CLEAR_STR | |
4722 | IP_STR | |
4723 | BGP_STR | |
4724 | "Clear peers with the AS number\n" | |
4725 | "Soft reconfig\n" | |
4726 | "Soft reconfig outbound update\n") | |
4727 | { | |
4728 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
4729 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4730 | } | |
4731 | ||
4732 | ALIAS (clear_ip_bgp_as_soft_out, | |
4733 | clear_ip_bgp_as_out_cmd, | |
4734 | "clear ip bgp <1-65535> out", | |
4735 | CLEAR_STR | |
4736 | IP_STR | |
4737 | BGP_STR | |
4738 | "Clear peers with the AS number\n" | |
4739 | "Soft reconfig outbound update\n") | |
4740 | ||
4741 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
4742 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
4743 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out", | |
4744 | CLEAR_STR | |
4745 | IP_STR | |
4746 | BGP_STR | |
4747 | "Clear peers with the AS number\n" | |
4748 | "Address family\n" | |
4749 | "Address Family modifier\n" | |
4750 | "Address Family modifier\n" | |
4751 | "Soft reconfig\n" | |
4752 | "Soft reconfig outbound update\n") | |
4753 | { | |
4754 | if (strncmp (argv[1], "m", 1) == 0) | |
4755 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
4756 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4757 | ||
4758 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
4759 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4760 | } | |
4761 | ||
4762 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
4763 | clear_ip_bgp_as_ipv4_out_cmd, | |
4764 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) out", | |
4765 | CLEAR_STR | |
4766 | IP_STR | |
4767 | BGP_STR | |
4768 | "Clear peers with the AS number\n" | |
4769 | "Address family\n" | |
4770 | "Address Family modifier\n" | |
4771 | "Address Family modifier\n" | |
4772 | "Soft reconfig outbound update\n") | |
4773 | ||
4774 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
4775 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
4776 | "clear ip bgp <1-65535> vpnv4 unicast soft out", | |
4777 | CLEAR_STR | |
4778 | IP_STR | |
4779 | BGP_STR | |
4780 | "Clear peers with the AS number\n" | |
4781 | "Address family\n" | |
4782 | "Address Family modifier\n" | |
4783 | "Soft reconfig\n" | |
4784 | "Soft reconfig outbound update\n") | |
4785 | { | |
4786 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
4787 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4788 | } | |
4789 | ||
4790 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
4791 | clear_ip_bgp_as_vpnv4_out_cmd, | |
4792 | "clear ip bgp <1-65535> vpnv4 unicast out", | |
4793 | CLEAR_STR | |
4794 | IP_STR | |
4795 | BGP_STR | |
4796 | "Clear peers with the AS number\n" | |
4797 | "Address family\n" | |
4798 | "Address Family modifier\n" | |
4799 | "Soft reconfig outbound update\n") | |
4800 | ||
4801 | DEFUN (clear_bgp_as_soft_out, | |
4802 | clear_bgp_as_soft_out_cmd, | |
4803 | "clear bgp <1-65535> soft out", | |
4804 | CLEAR_STR | |
4805 | BGP_STR | |
4806 | "Clear peers with the AS number\n" | |
4807 | "Soft reconfig\n" | |
4808 | "Soft reconfig outbound update\n") | |
4809 | { | |
4810 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
4811 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4812 | } | |
4813 | ||
4814 | ALIAS (clear_bgp_as_soft_out, | |
4815 | clear_bgp_ipv6_as_soft_out_cmd, | |
4816 | "clear bgp ipv6 <1-65535> soft out", | |
4817 | CLEAR_STR | |
4818 | BGP_STR | |
4819 | "Address family\n" | |
4820 | "Clear peers with the AS number\n" | |
4821 | "Soft reconfig\n" | |
4822 | "Soft reconfig outbound update\n") | |
4823 | ||
4824 | ALIAS (clear_bgp_as_soft_out, | |
4825 | clear_bgp_as_out_cmd, | |
4826 | "clear bgp <1-65535> out", | |
4827 | CLEAR_STR | |
4828 | BGP_STR | |
4829 | "Clear peers with the AS number\n" | |
4830 | "Soft reconfig outbound update\n") | |
4831 | ||
4832 | ALIAS (clear_bgp_as_soft_out, | |
4833 | clear_bgp_ipv6_as_out_cmd, | |
4834 | "clear bgp ipv6 <1-65535> out", | |
4835 | CLEAR_STR | |
4836 | BGP_STR | |
4837 | "Address family\n" | |
4838 | "Clear peers with the AS number\n" | |
4839 | "Soft reconfig outbound update\n") | |
4840 | \f | |
4841 | /* Inbound soft-reconfiguration */ | |
4842 | DEFUN (clear_ip_bgp_all_soft_in, | |
4843 | clear_ip_bgp_all_soft_in_cmd, | |
4844 | "clear ip bgp * soft in", | |
4845 | CLEAR_STR | |
4846 | IP_STR | |
4847 | BGP_STR | |
4848 | "Clear all peers\n" | |
4849 | "Soft reconfig\n" | |
4850 | "Soft reconfig inbound update\n") | |
4851 | { | |
4852 | if (argc == 1) | |
4853 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4854 | BGP_CLEAR_SOFT_IN, NULL); | |
4855 | ||
4856 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4857 | BGP_CLEAR_SOFT_IN, NULL); | |
4858 | } | |
4859 | ||
4860 | ALIAS (clear_ip_bgp_all_soft_in, | |
4861 | clear_ip_bgp_instance_all_soft_in_cmd, | |
4862 | "clear ip bgp view WORD * soft in", | |
4863 | CLEAR_STR | |
4864 | IP_STR | |
4865 | BGP_STR | |
4866 | "BGP view\n" | |
4867 | "view name\n" | |
4868 | "Clear all peers\n" | |
4869 | "Soft reconfig\n" | |
4870 | "Soft reconfig inbound update\n") | |
4871 | ||
4872 | ALIAS (clear_ip_bgp_all_soft_in, | |
4873 | clear_ip_bgp_all_in_cmd, | |
4874 | "clear ip bgp * in", | |
4875 | CLEAR_STR | |
4876 | IP_STR | |
4877 | BGP_STR | |
4878 | "Clear all peers\n" | |
4879 | "Soft reconfig inbound update\n") | |
4880 | ||
4881 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
4882 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
4883 | "clear ip bgp * in prefix-filter", | |
4884 | CLEAR_STR | |
4885 | IP_STR | |
4886 | BGP_STR | |
4887 | "Clear all peers\n" | |
4888 | "Soft reconfig inbound update\n" | |
4889 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
4890 | { | |
4891 | if (argc== 1) | |
4892 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4893 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
4894 | ||
4895 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4896 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
4897 | } | |
4898 | ||
4899 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
4900 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
4901 | "clear ip bgp view WORD * in prefix-filter", | |
4902 | CLEAR_STR | |
4903 | IP_STR | |
4904 | BGP_STR | |
4905 | "BGP view\n" | |
4906 | "view name\n" | |
4907 | "Clear all peers\n" | |
4908 | "Soft reconfig inbound update\n" | |
4909 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
4910 | ||
4911 | ||
4912 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
4913 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
4914 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
4915 | CLEAR_STR | |
4916 | IP_STR | |
4917 | BGP_STR | |
4918 | "Clear all peers\n" | |
4919 | "Address family\n" | |
4920 | "Address Family modifier\n" | |
4921 | "Address Family modifier\n" | |
4922 | "Soft reconfig\n" | |
4923 | "Soft reconfig inbound update\n") | |
4924 | { | |
4925 | if (strncmp (argv[0], "m", 1) == 0) | |
4926 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
4927 | BGP_CLEAR_SOFT_IN, NULL); | |
4928 | ||
4929 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4930 | BGP_CLEAR_SOFT_IN, NULL); | |
4931 | } | |
4932 | ||
4933 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
4934 | clear_ip_bgp_all_ipv4_in_cmd, | |
4935 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
4936 | CLEAR_STR | |
4937 | IP_STR | |
4938 | BGP_STR | |
4939 | "Clear all peers\n" | |
4940 | "Address family\n" | |
4941 | "Address Family modifier\n" | |
4942 | "Address Family modifier\n" | |
4943 | "Soft reconfig inbound update\n") | |
4944 | ||
4945 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
4946 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
4947 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
4948 | CLEAR_STR | |
4949 | IP_STR | |
4950 | BGP_STR | |
4951 | "BGP view\n" | |
4952 | "view name\n" | |
4953 | "Clear all peers\n" | |
4954 | "Address family\n" | |
4955 | "Address Family modifier\n" | |
4956 | "Address Family modifier\n" | |
4957 | "Soft reconfig\n" | |
4958 | "Soft reconfig inbound update\n") | |
4959 | { | |
4960 | if (strncmp (argv[1], "m", 1) == 0) | |
4961 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
4962 | BGP_CLEAR_SOFT_IN, NULL); | |
4963 | ||
4964 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4965 | BGP_CLEAR_SOFT_IN, NULL); | |
4966 | } | |
4967 | ||
4968 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
4969 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
4970 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
4971 | CLEAR_STR | |
4972 | IP_STR | |
4973 | BGP_STR | |
4974 | "Clear all peers\n" | |
4975 | "Address family\n" | |
4976 | "Address Family modifier\n" | |
4977 | "Address Family modifier\n" | |
4978 | "Soft reconfig inbound update\n" | |
4979 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
4980 | { | |
4981 | if (strncmp (argv[0], "m", 1) == 0) | |
4982 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
4983 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
4984 | ||
4985 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4986 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
4987 | } | |
4988 | ||
4989 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
4990 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
4991 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
4992 | CLEAR_STR | |
4993 | IP_STR | |
4994 | BGP_STR | |
4995 | "Clear all peers\n" | |
4996 | "Address family\n" | |
4997 | "Address Family modifier\n" | |
4998 | "Address Family modifier\n" | |
4999 | "Soft reconfig inbound update\n" | |
5000 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5001 | { | |
5002 | if (strncmp (argv[1], "m", 1) == 0) | |
5003 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5004 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5005 | ||
5006 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5007 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5008 | } | |
5009 | ||
5010 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
5011 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
5012 | "clear ip bgp * vpnv4 unicast soft in", | |
5013 | CLEAR_STR | |
5014 | IP_STR | |
5015 | BGP_STR | |
5016 | "Clear all peers\n" | |
5017 | "Address family\n" | |
5018 | "Address Family Modifier\n" | |
5019 | "Soft reconfig\n" | |
5020 | "Soft reconfig inbound update\n") | |
5021 | { | |
5022 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5023 | BGP_CLEAR_SOFT_IN, NULL); | |
5024 | } | |
5025 | ||
5026 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
5027 | clear_ip_bgp_all_vpnv4_in_cmd, | |
5028 | "clear ip bgp * vpnv4 unicast in", | |
5029 | CLEAR_STR | |
5030 | IP_STR | |
5031 | BGP_STR | |
5032 | "Clear all peers\n" | |
5033 | "Address family\n" | |
5034 | "Address Family Modifier\n" | |
5035 | "Soft reconfig inbound update\n") | |
5036 | ||
5037 | DEFUN (clear_bgp_all_soft_in, | |
5038 | clear_bgp_all_soft_in_cmd, | |
5039 | "clear bgp * soft in", | |
5040 | CLEAR_STR | |
5041 | BGP_STR | |
5042 | "Clear all peers\n" | |
5043 | "Soft reconfig\n" | |
5044 | "Soft reconfig inbound update\n") | |
5045 | { | |
5046 | if (argc == 1) | |
5047 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5048 | BGP_CLEAR_SOFT_IN, NULL); | |
5049 | ||
5050 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5051 | BGP_CLEAR_SOFT_IN, NULL); | |
5052 | } | |
5053 | ||
5054 | ALIAS (clear_bgp_all_soft_in, | |
5055 | clear_bgp_instance_all_soft_in_cmd, | |
5056 | "clear bgp view WORD * soft in", | |
5057 | CLEAR_STR | |
5058 | BGP_STR | |
5059 | "BGP view\n" | |
5060 | "view name\n" | |
5061 | "Clear all peers\n" | |
5062 | "Soft reconfig\n" | |
5063 | "Soft reconfig inbound update\n") | |
5064 | ||
5065 | ALIAS (clear_bgp_all_soft_in, | |
5066 | clear_bgp_ipv6_all_soft_in_cmd, | |
5067 | "clear bgp ipv6 * soft in", | |
5068 | CLEAR_STR | |
5069 | BGP_STR | |
5070 | "Address family\n" | |
5071 | "Clear all peers\n" | |
5072 | "Soft reconfig\n" | |
5073 | "Soft reconfig inbound update\n") | |
5074 | ||
5075 | ALIAS (clear_bgp_all_soft_in, | |
5076 | clear_bgp_all_in_cmd, | |
5077 | "clear bgp * in", | |
5078 | CLEAR_STR | |
5079 | BGP_STR | |
5080 | "Clear all peers\n" | |
5081 | "Soft reconfig inbound update\n") | |
5082 | ||
5083 | ALIAS (clear_bgp_all_soft_in, | |
5084 | clear_bgp_ipv6_all_in_cmd, | |
5085 | "clear bgp ipv6 * in", | |
5086 | CLEAR_STR | |
5087 | BGP_STR | |
5088 | "Address family\n" | |
5089 | "Clear all peers\n" | |
5090 | "Soft reconfig inbound update\n") | |
5091 | ||
5092 | DEFUN (clear_bgp_all_in_prefix_filter, | |
5093 | clear_bgp_all_in_prefix_filter_cmd, | |
5094 | "clear bgp * in prefix-filter", | |
5095 | CLEAR_STR | |
5096 | BGP_STR | |
5097 | "Clear all peers\n" | |
5098 | "Soft reconfig inbound update\n" | |
5099 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5100 | { | |
5101 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5102 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5103 | } | |
5104 | ||
5105 | ALIAS (clear_bgp_all_in_prefix_filter, | |
5106 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
5107 | "clear bgp ipv6 * in prefix-filter", | |
5108 | CLEAR_STR | |
5109 | BGP_STR | |
5110 | "Address family\n" | |
5111 | "Clear all peers\n" | |
5112 | "Soft reconfig inbound update\n" | |
5113 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5114 | ||
5115 | DEFUN (clear_ip_bgp_peer_soft_in, | |
5116 | clear_ip_bgp_peer_soft_in_cmd, | |
5117 | "clear ip bgp A.B.C.D soft in", | |
5118 | CLEAR_STR | |
5119 | IP_STR | |
5120 | BGP_STR | |
5121 | "BGP neighbor address to clear\n" | |
5122 | "Soft reconfig\n" | |
5123 | "Soft reconfig inbound update\n") | |
5124 | { | |
5125 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5126 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5127 | } | |
5128 | ||
5129 | ALIAS (clear_ip_bgp_peer_soft_in, | |
5130 | clear_ip_bgp_peer_in_cmd, | |
5131 | "clear ip bgp A.B.C.D in", | |
5132 | CLEAR_STR | |
5133 | IP_STR | |
5134 | BGP_STR | |
5135 | "BGP neighbor address to clear\n" | |
5136 | "Soft reconfig inbound update\n") | |
5137 | ||
5138 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
5139 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
5140 | "clear ip bgp A.B.C.D in prefix-filter", | |
5141 | CLEAR_STR | |
5142 | IP_STR | |
5143 | BGP_STR | |
5144 | "BGP neighbor address to clear\n" | |
5145 | "Soft reconfig inbound update\n" | |
5146 | "Push out the existing ORF prefix-list\n") | |
5147 | { | |
5148 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5149 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5150 | } | |
5151 | ||
5152 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
5153 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
5154 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", | |
5155 | CLEAR_STR | |
5156 | IP_STR | |
5157 | BGP_STR | |
5158 | "BGP neighbor address to clear\n" | |
5159 | "Address family\n" | |
5160 | "Address Family modifier\n" | |
5161 | "Address Family modifier\n" | |
5162 | "Soft reconfig\n" | |
5163 | "Soft reconfig inbound update\n") | |
5164 | { | |
5165 | if (strncmp (argv[1], "m", 1) == 0) | |
5166 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5167 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5168 | ||
5169 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5170 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5171 | } | |
5172 | ||
5173 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
5174 | clear_ip_bgp_peer_ipv4_in_cmd, | |
5175 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", | |
5176 | CLEAR_STR | |
5177 | IP_STR | |
5178 | BGP_STR | |
5179 | "BGP neighbor address to clear\n" | |
5180 | "Address family\n" | |
5181 | "Address Family modifier\n" | |
5182 | "Address Family modifier\n" | |
5183 | "Soft reconfig inbound update\n") | |
5184 | ||
5185 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
5186 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
5187 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", | |
5188 | CLEAR_STR | |
5189 | IP_STR | |
5190 | BGP_STR | |
5191 | "BGP neighbor address to clear\n" | |
5192 | "Address family\n" | |
5193 | "Address Family modifier\n" | |
5194 | "Address Family modifier\n" | |
5195 | "Soft reconfig inbound update\n" | |
5196 | "Push out the existing ORF prefix-list\n") | |
5197 | { | |
5198 | if (strncmp (argv[1], "m", 1) == 0) | |
5199 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5200 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5201 | ||
5202 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5203 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5204 | } | |
5205 | ||
5206 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
5207 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
5208 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", | |
5209 | CLEAR_STR | |
5210 | IP_STR | |
5211 | BGP_STR | |
5212 | "BGP neighbor address to clear\n" | |
5213 | "Address family\n" | |
5214 | "Address Family Modifier\n" | |
5215 | "Soft reconfig\n" | |
5216 | "Soft reconfig inbound update\n") | |
5217 | { | |
5218 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5219 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5220 | } | |
5221 | ||
5222 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
5223 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
5224 | "clear ip bgp A.B.C.D vpnv4 unicast in", | |
5225 | CLEAR_STR | |
5226 | IP_STR | |
5227 | BGP_STR | |
5228 | "BGP neighbor address to clear\n" | |
5229 | "Address family\n" | |
5230 | "Address Family Modifier\n" | |
5231 | "Soft reconfig inbound update\n") | |
5232 | ||
5233 | DEFUN (clear_bgp_peer_soft_in, | |
5234 | clear_bgp_peer_soft_in_cmd, | |
5235 | "clear bgp (A.B.C.D|X:X::X:X) soft in", | |
5236 | CLEAR_STR | |
5237 | BGP_STR | |
5238 | "BGP neighbor address to clear\n" | |
5239 | "BGP IPv6 neighbor to clear\n" | |
5240 | "Soft reconfig\n" | |
5241 | "Soft reconfig inbound update\n") | |
5242 | { | |
5243 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5244 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5245 | } | |
5246 | ||
5247 | ALIAS (clear_bgp_peer_soft_in, | |
5248 | clear_bgp_ipv6_peer_soft_in_cmd, | |
5249 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", | |
5250 | CLEAR_STR | |
5251 | BGP_STR | |
5252 | "Address family\n" | |
5253 | "BGP neighbor address to clear\n" | |
5254 | "BGP IPv6 neighbor to clear\n" | |
5255 | "Soft reconfig\n" | |
5256 | "Soft reconfig inbound update\n") | |
5257 | ||
5258 | ALIAS (clear_bgp_peer_soft_in, | |
5259 | clear_bgp_peer_in_cmd, | |
5260 | "clear bgp (A.B.C.D|X:X::X:X) in", | |
5261 | CLEAR_STR | |
5262 | BGP_STR | |
5263 | "BGP neighbor address to clear\n" | |
5264 | "BGP IPv6 neighbor to clear\n" | |
5265 | "Soft reconfig inbound update\n") | |
5266 | ||
5267 | ALIAS (clear_bgp_peer_soft_in, | |
5268 | clear_bgp_ipv6_peer_in_cmd, | |
5269 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", | |
5270 | CLEAR_STR | |
5271 | BGP_STR | |
5272 | "Address family\n" | |
5273 | "BGP neighbor address to clear\n" | |
5274 | "BGP IPv6 neighbor to clear\n" | |
5275 | "Soft reconfig inbound update\n") | |
5276 | ||
5277 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
5278 | clear_bgp_peer_in_prefix_filter_cmd, | |
5279 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", | |
5280 | CLEAR_STR | |
5281 | BGP_STR | |
5282 | "BGP neighbor address to clear\n" | |
5283 | "BGP IPv6 neighbor to clear\n" | |
5284 | "Soft reconfig inbound update\n" | |
5285 | "Push out the existing ORF prefix-list\n") | |
5286 | { | |
5287 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5288 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5289 | } | |
5290 | ||
5291 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
5292 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
5293 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", | |
5294 | CLEAR_STR | |
5295 | BGP_STR | |
5296 | "Address family\n" | |
5297 | "BGP neighbor address to clear\n" | |
5298 | "BGP IPv6 neighbor to clear\n" | |
5299 | "Soft reconfig inbound update\n" | |
5300 | "Push out the existing ORF prefix-list\n") | |
5301 | ||
5302 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
5303 | clear_ip_bgp_peer_group_soft_in_cmd, | |
5304 | "clear ip bgp peer-group WORD soft in", | |
5305 | CLEAR_STR | |
5306 | IP_STR | |
5307 | BGP_STR | |
5308 | "Clear all members of peer-group\n" | |
5309 | "BGP peer-group name\n" | |
5310 | "Soft reconfig\n" | |
5311 | "Soft reconfig inbound update\n") | |
5312 | { | |
5313 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5314 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5315 | } | |
5316 | ||
5317 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
5318 | clear_ip_bgp_peer_group_in_cmd, | |
5319 | "clear ip bgp peer-group WORD in", | |
5320 | CLEAR_STR | |
5321 | IP_STR | |
5322 | BGP_STR | |
5323 | "Clear all members of peer-group\n" | |
5324 | "BGP peer-group name\n" | |
5325 | "Soft reconfig inbound update\n") | |
5326 | ||
5327 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
5328 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
5329 | "clear ip bgp peer-group WORD in prefix-filter", | |
5330 | CLEAR_STR | |
5331 | IP_STR | |
5332 | BGP_STR | |
5333 | "Clear all members of peer-group\n" | |
5334 | "BGP peer-group name\n" | |
5335 | "Soft reconfig inbound update\n" | |
5336 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5337 | { | |
5338 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5339 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5340 | } | |
5341 | ||
5342 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
5343 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
5344 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
5345 | CLEAR_STR | |
5346 | IP_STR | |
5347 | BGP_STR | |
5348 | "Clear all members of peer-group\n" | |
5349 | "BGP peer-group name\n" | |
5350 | "Address family\n" | |
5351 | "Address Family modifier\n" | |
5352 | "Address Family modifier\n" | |
5353 | "Soft reconfig\n" | |
5354 | "Soft reconfig inbound update\n") | |
5355 | { | |
5356 | if (strncmp (argv[1], "m", 1) == 0) | |
5357 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5358 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5359 | ||
5360 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5361 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5362 | } | |
5363 | ||
5364 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
5365 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
5366 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
5367 | CLEAR_STR | |
5368 | IP_STR | |
5369 | BGP_STR | |
5370 | "Clear all members of peer-group\n" | |
5371 | "BGP peer-group name\n" | |
5372 | "Address family\n" | |
5373 | "Address Family modifier\n" | |
5374 | "Address Family modifier\n" | |
5375 | "Soft reconfig inbound update\n") | |
5376 | ||
5377 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
5378 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
5379 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
5380 | CLEAR_STR | |
5381 | IP_STR | |
5382 | BGP_STR | |
5383 | "Clear all members of peer-group\n" | |
5384 | "BGP peer-group name\n" | |
5385 | "Address family\n" | |
5386 | "Address Family modifier\n" | |
5387 | "Address Family modifier\n" | |
5388 | "Soft reconfig inbound update\n" | |
5389 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5390 | { | |
5391 | if (strncmp (argv[1], "m", 1) == 0) | |
5392 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5393 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5394 | ||
5395 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5396 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5397 | } | |
5398 | ||
5399 | DEFUN (clear_bgp_peer_group_soft_in, | |
5400 | clear_bgp_peer_group_soft_in_cmd, | |
5401 | "clear bgp peer-group WORD soft in", | |
5402 | CLEAR_STR | |
5403 | BGP_STR | |
5404 | "Clear all members of peer-group\n" | |
5405 | "BGP peer-group name\n" | |
5406 | "Soft reconfig\n" | |
5407 | "Soft reconfig inbound update\n") | |
5408 | { | |
5409 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5410 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5411 | } | |
5412 | ||
5413 | ALIAS (clear_bgp_peer_group_soft_in, | |
5414 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
5415 | "clear bgp ipv6 peer-group WORD soft in", | |
5416 | CLEAR_STR | |
5417 | BGP_STR | |
5418 | "Address family\n" | |
5419 | "Clear all members of peer-group\n" | |
5420 | "BGP peer-group name\n" | |
5421 | "Soft reconfig\n" | |
5422 | "Soft reconfig inbound update\n") | |
5423 | ||
5424 | ALIAS (clear_bgp_peer_group_soft_in, | |
5425 | clear_bgp_peer_group_in_cmd, | |
5426 | "clear bgp peer-group WORD in", | |
5427 | CLEAR_STR | |
5428 | BGP_STR | |
5429 | "Clear all members of peer-group\n" | |
5430 | "BGP peer-group name\n" | |
5431 | "Soft reconfig inbound update\n") | |
5432 | ||
5433 | ALIAS (clear_bgp_peer_group_soft_in, | |
5434 | clear_bgp_ipv6_peer_group_in_cmd, | |
5435 | "clear bgp ipv6 peer-group WORD in", | |
5436 | CLEAR_STR | |
5437 | BGP_STR | |
5438 | "Address family\n" | |
5439 | "Clear all members of peer-group\n" | |
5440 | "BGP peer-group name\n" | |
5441 | "Soft reconfig inbound update\n") | |
5442 | ||
5443 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
5444 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
5445 | "clear bgp peer-group WORD in prefix-filter", | |
5446 | CLEAR_STR | |
5447 | BGP_STR | |
5448 | "Clear all members of peer-group\n" | |
5449 | "BGP peer-group name\n" | |
5450 | "Soft reconfig inbound update\n" | |
5451 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5452 | { | |
5453 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5454 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5455 | } | |
5456 | ||
5457 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
5458 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
5459 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
5460 | CLEAR_STR | |
5461 | BGP_STR | |
5462 | "Address family\n" | |
5463 | "Clear all members of peer-group\n" | |
5464 | "BGP peer-group name\n" | |
5465 | "Soft reconfig inbound update\n" | |
5466 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5467 | ||
5468 | DEFUN (clear_ip_bgp_external_soft_in, | |
5469 | clear_ip_bgp_external_soft_in_cmd, | |
5470 | "clear ip bgp external soft in", | |
5471 | CLEAR_STR | |
5472 | IP_STR | |
5473 | BGP_STR | |
5474 | "Clear all external peers\n" | |
5475 | "Soft reconfig\n" | |
5476 | "Soft reconfig inbound update\n") | |
5477 | { | |
5478 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5479 | BGP_CLEAR_SOFT_IN, NULL); | |
5480 | } | |
5481 | ||
5482 | ALIAS (clear_ip_bgp_external_soft_in, | |
5483 | clear_ip_bgp_external_in_cmd, | |
5484 | "clear ip bgp external in", | |
5485 | CLEAR_STR | |
5486 | IP_STR | |
5487 | BGP_STR | |
5488 | "Clear all external peers\n" | |
5489 | "Soft reconfig inbound update\n") | |
5490 | ||
5491 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
5492 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
5493 | "clear ip bgp external in prefix-filter", | |
5494 | CLEAR_STR | |
5495 | IP_STR | |
5496 | BGP_STR | |
5497 | "Clear all external peers\n" | |
5498 | "Soft reconfig inbound update\n" | |
5499 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5500 | { | |
5501 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5502 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5503 | } | |
5504 | ||
5505 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
5506 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
5507 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
5508 | CLEAR_STR | |
5509 | IP_STR | |
5510 | BGP_STR | |
5511 | "Clear all external peers\n" | |
5512 | "Address family\n" | |
5513 | "Address Family modifier\n" | |
5514 | "Address Family modifier\n" | |
5515 | "Soft reconfig\n" | |
5516 | "Soft reconfig inbound update\n") | |
5517 | { | |
5518 | if (strncmp (argv[0], "m", 1) == 0) | |
5519 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
5520 | BGP_CLEAR_SOFT_IN, NULL); | |
5521 | ||
5522 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5523 | BGP_CLEAR_SOFT_IN, NULL); | |
5524 | } | |
5525 | ||
5526 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
5527 | clear_ip_bgp_external_ipv4_in_cmd, | |
5528 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
5529 | CLEAR_STR | |
5530 | IP_STR | |
5531 | BGP_STR | |
5532 | "Clear all external peers\n" | |
5533 | "Address family\n" | |
5534 | "Address Family modifier\n" | |
5535 | "Address Family modifier\n" | |
5536 | "Soft reconfig inbound update\n") | |
5537 | ||
5538 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
5539 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
5540 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
5541 | CLEAR_STR | |
5542 | IP_STR | |
5543 | BGP_STR | |
5544 | "Clear all external peers\n" | |
5545 | "Address family\n" | |
5546 | "Address Family modifier\n" | |
5547 | "Address Family modifier\n" | |
5548 | "Soft reconfig inbound update\n" | |
5549 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5550 | { | |
5551 | if (strncmp (argv[0], "m", 1) == 0) | |
5552 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
5553 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5554 | ||
5555 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5556 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5557 | } | |
5558 | ||
5559 | DEFUN (clear_bgp_external_soft_in, | |
5560 | clear_bgp_external_soft_in_cmd, | |
5561 | "clear bgp external soft in", | |
5562 | CLEAR_STR | |
5563 | BGP_STR | |
5564 | "Clear all external peers\n" | |
5565 | "Soft reconfig\n" | |
5566 | "Soft reconfig inbound update\n") | |
5567 | { | |
5568 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
5569 | BGP_CLEAR_SOFT_IN, NULL); | |
5570 | } | |
5571 | ||
5572 | ALIAS (clear_bgp_external_soft_in, | |
5573 | clear_bgp_ipv6_external_soft_in_cmd, | |
5574 | "clear bgp ipv6 external soft in", | |
5575 | CLEAR_STR | |
5576 | BGP_STR | |
5577 | "Address family\n" | |
5578 | "Clear all external peers\n" | |
5579 | "Soft reconfig\n" | |
5580 | "Soft reconfig inbound update\n") | |
5581 | ||
5582 | ALIAS (clear_bgp_external_soft_in, | |
5583 | clear_bgp_external_in_cmd, | |
5584 | "clear bgp external in", | |
5585 | CLEAR_STR | |
5586 | BGP_STR | |
5587 | "Clear all external peers\n" | |
5588 | "Soft reconfig inbound update\n") | |
5589 | ||
5590 | ALIAS (clear_bgp_external_soft_in, | |
5591 | clear_bgp_ipv6_external_in_cmd, | |
5592 | "clear bgp ipv6 external WORD in", | |
5593 | CLEAR_STR | |
5594 | BGP_STR | |
5595 | "Address family\n" | |
5596 | "Clear all external peers\n" | |
5597 | "Soft reconfig inbound update\n") | |
5598 | ||
5599 | DEFUN (clear_bgp_external_in_prefix_filter, | |
5600 | clear_bgp_external_in_prefix_filter_cmd, | |
5601 | "clear bgp external in prefix-filter", | |
5602 | CLEAR_STR | |
5603 | BGP_STR | |
5604 | "Clear all external peers\n" | |
5605 | "Soft reconfig inbound update\n" | |
5606 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5607 | { | |
5608 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
5609 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5610 | } | |
5611 | ||
5612 | ALIAS (clear_bgp_external_in_prefix_filter, | |
5613 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
5614 | "clear bgp ipv6 external in prefix-filter", | |
5615 | CLEAR_STR | |
5616 | BGP_STR | |
5617 | "Address family\n" | |
5618 | "Clear all external peers\n" | |
5619 | "Soft reconfig inbound update\n" | |
5620 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5621 | ||
5622 | DEFUN (clear_ip_bgp_as_soft_in, | |
5623 | clear_ip_bgp_as_soft_in_cmd, | |
5624 | "clear ip bgp <1-65535> soft in", | |
5625 | CLEAR_STR | |
5626 | IP_STR | |
5627 | BGP_STR | |
5628 | "Clear peers with the AS number\n" | |
5629 | "Soft reconfig\n" | |
5630 | "Soft reconfig inbound update\n") | |
5631 | { | |
5632 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5633 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5634 | } | |
5635 | ||
5636 | ALIAS (clear_ip_bgp_as_soft_in, | |
5637 | clear_ip_bgp_as_in_cmd, | |
5638 | "clear ip bgp <1-65535> in", | |
5639 | CLEAR_STR | |
5640 | IP_STR | |
5641 | BGP_STR | |
5642 | "Clear peers with the AS number\n" | |
5643 | "Soft reconfig inbound update\n") | |
5644 | ||
5645 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
5646 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
5647 | "clear ip bgp <1-65535> in prefix-filter", | |
5648 | CLEAR_STR | |
5649 | IP_STR | |
5650 | BGP_STR | |
5651 | "Clear peers with the AS number\n" | |
5652 | "Soft reconfig inbound update\n" | |
5653 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5654 | { | |
5655 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5656 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5657 | } | |
5658 | ||
5659 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
5660 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
5661 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in", | |
5662 | CLEAR_STR | |
5663 | IP_STR | |
5664 | BGP_STR | |
5665 | "Clear peers with the AS number\n" | |
5666 | "Address family\n" | |
5667 | "Address Family modifier\n" | |
5668 | "Address Family modifier\n" | |
5669 | "Soft reconfig\n" | |
5670 | "Soft reconfig inbound update\n") | |
5671 | { | |
5672 | if (strncmp (argv[1], "m", 1) == 0) | |
5673 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
5674 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5675 | ||
5676 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5677 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5678 | } | |
5679 | ||
5680 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
5681 | clear_ip_bgp_as_ipv4_in_cmd, | |
5682 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in", | |
5683 | CLEAR_STR | |
5684 | IP_STR | |
5685 | BGP_STR | |
5686 | "Clear peers with the AS number\n" | |
5687 | "Address family\n" | |
5688 | "Address Family modifier\n" | |
5689 | "Address Family modifier\n" | |
5690 | "Soft reconfig inbound update\n") | |
5691 | ||
5692 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
5693 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
5694 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter", | |
5695 | CLEAR_STR | |
5696 | IP_STR | |
5697 | BGP_STR | |
5698 | "Clear peers with the AS number\n" | |
5699 | "Address family\n" | |
5700 | "Address Family modifier\n" | |
5701 | "Address Family modifier\n" | |
5702 | "Soft reconfig inbound update\n" | |
5703 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5704 | { | |
5705 | if (strncmp (argv[1], "m", 1) == 0) | |
5706 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
5707 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5708 | ||
5709 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5710 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5711 | } | |
5712 | ||
5713 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
5714 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
5715 | "clear ip bgp <1-65535> vpnv4 unicast soft in", | |
5716 | CLEAR_STR | |
5717 | IP_STR | |
5718 | BGP_STR | |
5719 | "Clear peers with the AS number\n" | |
5720 | "Address family\n" | |
5721 | "Address Family modifier\n" | |
5722 | "Soft reconfig\n" | |
5723 | "Soft reconfig inbound update\n") | |
5724 | { | |
5725 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
5726 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5727 | } | |
5728 | ||
5729 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
5730 | clear_ip_bgp_as_vpnv4_in_cmd, | |
5731 | "clear ip bgp <1-65535> vpnv4 unicast in", | |
5732 | CLEAR_STR | |
5733 | IP_STR | |
5734 | BGP_STR | |
5735 | "Clear peers with the AS number\n" | |
5736 | "Address family\n" | |
5737 | "Address Family modifier\n" | |
5738 | "Soft reconfig inbound update\n") | |
5739 | ||
5740 | DEFUN (clear_bgp_as_soft_in, | |
5741 | clear_bgp_as_soft_in_cmd, | |
5742 | "clear bgp <1-65535> soft in", | |
5743 | CLEAR_STR | |
5744 | BGP_STR | |
5745 | "Clear peers with the AS number\n" | |
5746 | "Soft reconfig\n" | |
5747 | "Soft reconfig inbound update\n") | |
5748 | { | |
5749 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
5750 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5751 | } | |
5752 | ||
5753 | ALIAS (clear_bgp_as_soft_in, | |
5754 | clear_bgp_ipv6_as_soft_in_cmd, | |
5755 | "clear bgp ipv6 <1-65535> soft in", | |
5756 | CLEAR_STR | |
5757 | BGP_STR | |
5758 | "Address family\n" | |
5759 | "Clear peers with the AS number\n" | |
5760 | "Soft reconfig\n" | |
5761 | "Soft reconfig inbound update\n") | |
5762 | ||
5763 | ALIAS (clear_bgp_as_soft_in, | |
5764 | clear_bgp_as_in_cmd, | |
5765 | "clear bgp <1-65535> in", | |
5766 | CLEAR_STR | |
5767 | BGP_STR | |
5768 | "Clear peers with the AS number\n" | |
5769 | "Soft reconfig inbound update\n") | |
5770 | ||
5771 | ALIAS (clear_bgp_as_soft_in, | |
5772 | clear_bgp_ipv6_as_in_cmd, | |
5773 | "clear bgp ipv6 <1-65535> in", | |
5774 | CLEAR_STR | |
5775 | BGP_STR | |
5776 | "Address family\n" | |
5777 | "Clear peers with the AS number\n" | |
5778 | "Soft reconfig inbound update\n") | |
5779 | ||
5780 | DEFUN (clear_bgp_as_in_prefix_filter, | |
5781 | clear_bgp_as_in_prefix_filter_cmd, | |
5782 | "clear bgp <1-65535> in prefix-filter", | |
5783 | CLEAR_STR | |
5784 | BGP_STR | |
5785 | "Clear peers with the AS number\n" | |
5786 | "Soft reconfig inbound update\n" | |
5787 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5788 | { | |
5789 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
5790 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5791 | } | |
5792 | ||
5793 | ALIAS (clear_bgp_as_in_prefix_filter, | |
5794 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
5795 | "clear bgp ipv6 <1-65535> in prefix-filter", | |
5796 | CLEAR_STR | |
5797 | BGP_STR | |
5798 | "Address family\n" | |
5799 | "Clear peers with the AS number\n" | |
5800 | "Soft reconfig inbound update\n" | |
5801 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5802 | \f | |
5803 | /* Both soft-reconfiguration */ | |
5804 | DEFUN (clear_ip_bgp_all_soft, | |
5805 | clear_ip_bgp_all_soft_cmd, | |
5806 | "clear ip bgp * soft", | |
5807 | CLEAR_STR | |
5808 | IP_STR | |
5809 | BGP_STR | |
5810 | "Clear all peers\n" | |
5811 | "Soft reconfig\n") | |
5812 | { | |
5813 | if (argc == 1) | |
5814 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5815 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5816 | ||
5817 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5818 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5819 | } | |
5820 | ||
5821 | ALIAS (clear_ip_bgp_all_soft, | |
5822 | clear_ip_bgp_instance_all_soft_cmd, | |
5823 | "clear ip bgp view WORD * soft", | |
5824 | CLEAR_STR | |
5825 | IP_STR | |
5826 | BGP_STR | |
5827 | "BGP view\n" | |
5828 | "view name\n" | |
5829 | "Clear all peers\n" | |
5830 | "Soft reconfig\n") | |
5831 | ||
5832 | ||
5833 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
5834 | clear_ip_bgp_all_ipv4_soft_cmd, | |
5835 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
5836 | CLEAR_STR | |
5837 | IP_STR | |
5838 | BGP_STR | |
5839 | "Clear all peers\n" | |
5840 | "Address family\n" | |
5841 | "Address Family Modifier\n" | |
5842 | "Address Family Modifier\n" | |
5843 | "Soft reconfig\n") | |
5844 | { | |
5845 | if (strncmp (argv[0], "m", 1) == 0) | |
5846 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5847 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5848 | ||
5849 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5850 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5851 | } | |
5852 | ||
5853 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
5854 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
5855 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
5856 | CLEAR_STR | |
5857 | IP_STR | |
5858 | BGP_STR | |
5859 | "BGP view\n" | |
5860 | "view name\n" | |
5861 | "Clear all peers\n" | |
5862 | "Address family\n" | |
5863 | "Address Family Modifier\n" | |
5864 | "Address Family Modifier\n" | |
5865 | "Soft reconfig\n") | |
5866 | { | |
5867 | if (strncmp (argv[1], "m", 1) == 0) | |
5868 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5869 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5870 | ||
5871 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5872 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5873 | } | |
5874 | ||
5875 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
5876 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
5877 | "clear ip bgp * vpnv4 unicast soft", | |
5878 | CLEAR_STR | |
5879 | IP_STR | |
5880 | BGP_STR | |
5881 | "Clear all peers\n" | |
5882 | "Address family\n" | |
5883 | "Address Family Modifier\n" | |
5884 | "Soft reconfig\n") | |
5885 | { | |
5886 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5887 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5888 | } | |
5889 | ||
5890 | DEFUN (clear_bgp_all_soft, | |
5891 | clear_bgp_all_soft_cmd, | |
5892 | "clear bgp * soft", | |
5893 | CLEAR_STR | |
5894 | BGP_STR | |
5895 | "Clear all peers\n" | |
5896 | "Soft reconfig\n") | |
5897 | { | |
5898 | if (argc == 1) | |
5899 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5900 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5901 | ||
5902 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5903 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5904 | } | |
5905 | ||
5906 | ALIAS (clear_bgp_all_soft, | |
5907 | clear_bgp_instance_all_soft_cmd, | |
5908 | "clear bgp view WORD * soft", | |
5909 | CLEAR_STR | |
5910 | BGP_STR | |
5911 | "BGP view\n" | |
5912 | "view name\n" | |
5913 | "Clear all peers\n" | |
5914 | "Soft reconfig\n") | |
5915 | ||
5916 | ALIAS (clear_bgp_all_soft, | |
5917 | clear_bgp_ipv6_all_soft_cmd, | |
5918 | "clear bgp ipv6 * soft", | |
5919 | CLEAR_STR | |
5920 | BGP_STR | |
5921 | "Address family\n" | |
5922 | "Clear all peers\n" | |
5923 | "Soft reconfig\n") | |
5924 | ||
5925 | DEFUN (clear_ip_bgp_peer_soft, | |
5926 | clear_ip_bgp_peer_soft_cmd, | |
5927 | "clear ip bgp A.B.C.D soft", | |
5928 | CLEAR_STR | |
5929 | IP_STR | |
5930 | BGP_STR | |
5931 | "BGP neighbor address to clear\n" | |
5932 | "Soft reconfig\n") | |
5933 | { | |
5934 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5935 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5936 | } | |
5937 | ||
5938 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
5939 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
5940 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", | |
5941 | CLEAR_STR | |
5942 | IP_STR | |
5943 | BGP_STR | |
5944 | "BGP neighbor address to clear\n" | |
5945 | "Address family\n" | |
5946 | "Address Family Modifier\n" | |
5947 | "Address Family Modifier\n" | |
5948 | "Soft reconfig\n") | |
5949 | { | |
5950 | if (strncmp (argv[1], "m", 1) == 0) | |
5951 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5952 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5953 | ||
5954 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5955 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5956 | } | |
5957 | ||
5958 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
5959 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
5960 | "clear ip bgp A.B.C.D vpnv4 unicast soft", | |
5961 | CLEAR_STR | |
5962 | IP_STR | |
5963 | BGP_STR | |
5964 | "BGP neighbor address to clear\n" | |
5965 | "Address family\n" | |
5966 | "Address Family Modifier\n" | |
5967 | "Soft reconfig\n") | |
5968 | { | |
5969 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5970 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5971 | } | |
5972 | ||
5973 | DEFUN (clear_bgp_peer_soft, | |
5974 | clear_bgp_peer_soft_cmd, | |
5975 | "clear bgp (A.B.C.D|X:X::X:X) soft", | |
5976 | CLEAR_STR | |
5977 | BGP_STR | |
5978 | "BGP neighbor address to clear\n" | |
5979 | "BGP IPv6 neighbor to clear\n" | |
5980 | "Soft reconfig\n") | |
5981 | { | |
5982 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5983 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
5984 | } | |
5985 | ||
5986 | ALIAS (clear_bgp_peer_soft, | |
5987 | clear_bgp_ipv6_peer_soft_cmd, | |
5988 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", | |
5989 | CLEAR_STR | |
5990 | BGP_STR | |
5991 | "Address family\n" | |
5992 | "BGP neighbor address to clear\n" | |
5993 | "BGP IPv6 neighbor to clear\n" | |
5994 | "Soft reconfig\n") | |
5995 | ||
5996 | DEFUN (clear_ip_bgp_peer_group_soft, | |
5997 | clear_ip_bgp_peer_group_soft_cmd, | |
5998 | "clear ip bgp peer-group WORD soft", | |
5999 | CLEAR_STR | |
6000 | IP_STR | |
6001 | BGP_STR | |
6002 | "Clear all members of peer-group\n" | |
6003 | "BGP peer-group name\n" | |
6004 | "Soft reconfig\n") | |
6005 | { | |
6006 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6007 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6008 | } | |
6009 | ||
6010 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
6011 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
6012 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
6013 | CLEAR_STR | |
6014 | IP_STR | |
6015 | BGP_STR | |
6016 | "Clear all members of peer-group\n" | |
6017 | "BGP peer-group name\n" | |
6018 | "Address family\n" | |
6019 | "Address Family modifier\n" | |
6020 | "Address Family modifier\n" | |
6021 | "Soft reconfig\n") | |
6022 | { | |
6023 | if (strncmp (argv[1], "m", 1) == 0) | |
6024 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6025 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6026 | ||
6027 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6028 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6029 | } | |
6030 | ||
6031 | DEFUN (clear_bgp_peer_group_soft, | |
6032 | clear_bgp_peer_group_soft_cmd, | |
6033 | "clear bgp peer-group WORD soft", | |
6034 | CLEAR_STR | |
6035 | BGP_STR | |
6036 | "Clear all members of peer-group\n" | |
6037 | "BGP peer-group name\n" | |
6038 | "Soft reconfig\n") | |
6039 | { | |
6040 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6041 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6042 | } | |
6043 | ||
6044 | ALIAS (clear_bgp_peer_group_soft, | |
6045 | clear_bgp_ipv6_peer_group_soft_cmd, | |
6046 | "clear bgp ipv6 peer-group WORD soft", | |
6047 | CLEAR_STR | |
6048 | BGP_STR | |
6049 | "Address family\n" | |
6050 | "Clear all members of peer-group\n" | |
6051 | "BGP peer-group name\n" | |
6052 | "Soft reconfig\n") | |
6053 | ||
6054 | DEFUN (clear_ip_bgp_external_soft, | |
6055 | clear_ip_bgp_external_soft_cmd, | |
6056 | "clear ip bgp external soft", | |
6057 | CLEAR_STR | |
6058 | IP_STR | |
6059 | BGP_STR | |
6060 | "Clear all external peers\n" | |
6061 | "Soft reconfig\n") | |
6062 | { | |
6063 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6064 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6065 | } | |
6066 | ||
6067 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
6068 | clear_ip_bgp_external_ipv4_soft_cmd, | |
6069 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
6070 | CLEAR_STR | |
6071 | IP_STR | |
6072 | BGP_STR | |
6073 | "Clear all external peers\n" | |
6074 | "Address family\n" | |
6075 | "Address Family modifier\n" | |
6076 | "Address Family modifier\n" | |
6077 | "Soft reconfig\n") | |
6078 | { | |
6079 | if (strncmp (argv[0], "m", 1) == 0) | |
6080 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6081 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6082 | ||
6083 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6084 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6085 | } | |
6086 | ||
6087 | DEFUN (clear_bgp_external_soft, | |
6088 | clear_bgp_external_soft_cmd, | |
6089 | "clear bgp external soft", | |
6090 | CLEAR_STR | |
6091 | BGP_STR | |
6092 | "Clear all external peers\n" | |
6093 | "Soft reconfig\n") | |
6094 | { | |
6095 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6096 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6097 | } | |
6098 | ||
6099 | ALIAS (clear_bgp_external_soft, | |
6100 | clear_bgp_ipv6_external_soft_cmd, | |
6101 | "clear bgp ipv6 external soft", | |
6102 | CLEAR_STR | |
6103 | BGP_STR | |
6104 | "Address family\n" | |
6105 | "Clear all external peers\n" | |
6106 | "Soft reconfig\n") | |
6107 | ||
6108 | DEFUN (clear_ip_bgp_as_soft, | |
6109 | clear_ip_bgp_as_soft_cmd, | |
6110 | "clear ip bgp <1-65535> soft", | |
6111 | CLEAR_STR | |
6112 | IP_STR | |
6113 | BGP_STR | |
6114 | "Clear peers with the AS number\n" | |
6115 | "Soft reconfig\n") | |
6116 | { | |
6117 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6118 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6119 | } | |
6120 | ||
6121 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
6122 | clear_ip_bgp_as_ipv4_soft_cmd, | |
6123 | "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft", | |
6124 | CLEAR_STR | |
6125 | IP_STR | |
6126 | BGP_STR | |
6127 | "Clear peers with the AS number\n" | |
6128 | "Address family\n" | |
6129 | "Address Family Modifier\n" | |
6130 | "Address Family Modifier\n" | |
6131 | "Soft reconfig\n") | |
6132 | { | |
6133 | if (strncmp (argv[1], "m", 1) == 0) | |
6134 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6135 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6136 | ||
6137 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
6138 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6139 | } | |
6140 | ||
6141 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
6142 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
6143 | "clear ip bgp <1-65535> vpnv4 unicast soft", | |
6144 | CLEAR_STR | |
6145 | IP_STR | |
6146 | BGP_STR | |
6147 | "Clear peers with the AS number\n" | |
6148 | "Address family\n" | |
6149 | "Address Family Modifier\n" | |
6150 | "Soft reconfig\n") | |
6151 | { | |
6152 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6153 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6154 | } | |
6155 | ||
6156 | DEFUN (clear_bgp_as_soft, | |
6157 | clear_bgp_as_soft_cmd, | |
6158 | "clear bgp <1-65535> soft", | |
6159 | CLEAR_STR | |
6160 | BGP_STR | |
6161 | "Clear peers with the AS number\n" | |
6162 | "Soft reconfig\n") | |
6163 | { | |
6164 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6165 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6166 | } | |
6167 | ||
6168 | ALIAS (clear_bgp_as_soft, | |
6169 | clear_bgp_ipv6_as_soft_cmd, | |
6170 | "clear bgp ipv6 <1-65535> soft", | |
6171 | CLEAR_STR | |
6172 | BGP_STR | |
6173 | "Address family\n" | |
6174 | "Clear peers with the AS number\n" | |
6175 | "Soft reconfig\n") | |
6176 | \f | |
fee0f4c6 | 6177 | /* RS-client soft reconfiguration. */ |
6178 | #ifdef HAVE_IPV6 | |
6179 | DEFUN (clear_bgp_all_rsclient, | |
6180 | clear_bgp_all_rsclient_cmd, | |
6181 | "clear bgp * rsclient", | |
6182 | CLEAR_STR | |
6183 | BGP_STR | |
6184 | "Clear all peers\n" | |
6185 | "Soft reconfig for rsclient RIB\n") | |
6186 | { | |
6187 | if (argc == 1) | |
6188 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6189 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6190 | ||
6191 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6192 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6193 | } | |
6194 | ||
6195 | ALIAS (clear_bgp_all_rsclient, | |
6196 | clear_bgp_ipv6_all_rsclient_cmd, | |
6197 | "clear bgp ipv6 * rsclient", | |
6198 | CLEAR_STR | |
6199 | BGP_STR | |
6200 | "Address family\n" | |
6201 | "Clear all peers\n" | |
6202 | "Soft reconfig for rsclient RIB\n") | |
6203 | ||
6204 | ALIAS (clear_bgp_all_rsclient, | |
6205 | clear_bgp_instance_all_rsclient_cmd, | |
6206 | "clear bgp view WORD * rsclient", | |
6207 | CLEAR_STR | |
6208 | BGP_STR | |
6209 | "BGP view\n" | |
6210 | "view name\n" | |
6211 | "Clear all peers\n" | |
6212 | "Soft reconfig for rsclient RIB\n") | |
6213 | ||
6214 | ALIAS (clear_bgp_all_rsclient, | |
6215 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
6216 | "clear bgp ipv6 view WORD * rsclient", | |
6217 | CLEAR_STR | |
6218 | BGP_STR | |
6219 | "Address family\n" | |
6220 | "BGP view\n" | |
6221 | "view name\n" | |
6222 | "Clear all peers\n" | |
6223 | "Soft reconfig for rsclient RIB\n") | |
6224 | #endif /* HAVE_IPV6 */ | |
6225 | ||
6226 | DEFUN (clear_ip_bgp_all_rsclient, | |
6227 | clear_ip_bgp_all_rsclient_cmd, | |
6228 | "clear ip bgp * rsclient", | |
6229 | CLEAR_STR | |
6230 | IP_STR | |
6231 | BGP_STR | |
6232 | "Clear all peers\n" | |
6233 | "Soft reconfig for rsclient RIB\n") | |
6234 | { | |
6235 | if (argc == 1) | |
6236 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6237 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6238 | ||
6239 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6240 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6241 | } | |
6242 | ||
6243 | ALIAS (clear_ip_bgp_all_rsclient, | |
6244 | clear_ip_bgp_instance_all_rsclient_cmd, | |
6245 | "clear ip bgp view WORD * rsclient", | |
6246 | CLEAR_STR | |
6247 | IP_STR | |
6248 | BGP_STR | |
6249 | "BGP view\n" | |
6250 | "view name\n" | |
6251 | "Clear all peers\n" | |
6252 | "Soft reconfig for rsclient RIB\n") | |
6253 | ||
6254 | #ifdef HAVE_IPV6 | |
6255 | DEFUN (clear_bgp_peer_rsclient, | |
6256 | clear_bgp_peer_rsclient_cmd, | |
6257 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", | |
6258 | CLEAR_STR | |
6259 | BGP_STR | |
6260 | "BGP neighbor IP address to clear\n" | |
6261 | "BGP IPv6 neighbor to clear\n" | |
6262 | "Soft reconfig for rsclient RIB\n") | |
6263 | { | |
6264 | if (argc == 2) | |
6265 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
6266 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
6267 | ||
6268 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6269 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
6270 | } | |
6271 | ||
6272 | ALIAS (clear_bgp_peer_rsclient, | |
6273 | clear_bgp_ipv6_peer_rsclient_cmd, | |
6274 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", | |
6275 | CLEAR_STR | |
6276 | BGP_STR | |
6277 | "Address family\n" | |
6278 | "BGP neighbor IP address to clear\n" | |
6279 | "BGP IPv6 neighbor to clear\n" | |
6280 | "Soft reconfig for rsclient RIB\n") | |
6281 | ||
6282 | ALIAS (clear_bgp_peer_rsclient, | |
6283 | clear_bgp_instance_peer_rsclient_cmd, | |
6284 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6285 | CLEAR_STR | |
6286 | BGP_STR | |
6287 | "BGP view\n" | |
6288 | "view name\n" | |
6289 | "BGP neighbor IP address to clear\n" | |
6290 | "BGP IPv6 neighbor to clear\n" | |
6291 | "Soft reconfig for rsclient RIB\n") | |
6292 | ||
6293 | ALIAS (clear_bgp_peer_rsclient, | |
6294 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
6295 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6296 | CLEAR_STR | |
6297 | BGP_STR | |
6298 | "Address family\n" | |
6299 | "BGP view\n" | |
6300 | "view name\n" | |
6301 | "BGP neighbor IP address to clear\n" | |
6302 | "BGP IPv6 neighbor to clear\n" | |
6303 | "Soft reconfig for rsclient RIB\n") | |
6304 | #endif /* HAVE_IPV6 */ | |
6305 | ||
6306 | DEFUN (clear_ip_bgp_peer_rsclient, | |
6307 | clear_ip_bgp_peer_rsclient_cmd, | |
6308 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", | |
6309 | CLEAR_STR | |
6310 | IP_STR | |
6311 | BGP_STR | |
6312 | "BGP neighbor IP address to clear\n" | |
6313 | "BGP IPv6 neighbor to clear\n" | |
6314 | "Soft reconfig for rsclient RIB\n") | |
6315 | { | |
6316 | if (argc == 2) | |
6317 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
6318 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
6319 | ||
6320 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6321 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
6322 | } | |
6323 | ||
6324 | ALIAS (clear_ip_bgp_peer_rsclient, | |
6325 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
6326 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6327 | CLEAR_STR | |
6328 | IP_STR | |
6329 | BGP_STR | |
6330 | "BGP view\n" | |
6331 | "view name\n" | |
6332 | "BGP neighbor IP address to clear\n" | |
6333 | "BGP IPv6 neighbor to clear\n" | |
6334 | "Soft reconfig for rsclient RIB\n") | |
6335 | ||
6336 | ||
718e3744 | 6337 | /* Show BGP peer's summary information. */ |
6338 | int | |
6339 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) | |
6340 | { | |
6341 | struct peer *peer; | |
6342 | struct listnode *nn; | |
6343 | int count = 0; | |
6344 | char timebuf[BGP_UPTIME_LEN]; | |
6345 | int len; | |
6346 | ||
6347 | /* Header string for each address family. */ | |
6348 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
6349 | ||
6350 | LIST_LOOP (bgp->peer, peer, nn) | |
6351 | { | |
6352 | if (peer->afc[afi][safi]) | |
6353 | { | |
6354 | if (! count) | |
6355 | { | |
6356 | vty_out (vty, | |
6357 | "BGP router identifier %s, local AS number %d%s", | |
6358 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); | |
6359 | vty_out (vty, | |
6360 | "%ld BGP AS-PATH entries%s", aspath_count (), | |
6361 | VTY_NEWLINE); | |
6362 | vty_out (vty, | |
6363 | "%ld BGP community entries%s", community_count (), | |
6364 | VTY_NEWLINE); | |
6365 | ||
6366 | if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
6367 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
6368 | vty_out (vty, "%s", VTY_NEWLINE); | |
6369 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
6370 | } | |
6371 | count++; | |
6372 | ||
6373 | len = vty_out (vty, "%s", peer->host); | |
6374 | len = 16 - len; | |
6375 | if (len < 1) | |
6376 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
6377 | else | |
6378 | vty_out (vty, "%*s", len, " "); | |
6379 | ||
6380 | switch (peer->version) | |
6381 | { | |
6382 | case BGP_VERSION_4: | |
6383 | vty_out (vty, "4 "); | |
6384 | break; | |
6385 | case BGP_VERSION_MP_4_DRAFT_00: | |
6386 | vty_out (vty, "4-"); | |
6387 | break; | |
6388 | } | |
6389 | ||
6390 | vty_out (vty, "%5d %7d %7d %8d %4d %4ld ", | |
6391 | peer->as, | |
6392 | peer->open_in + peer->update_in + peer->keepalive_in | |
6393 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, | |
6394 | peer->open_out + peer->update_out + peer->keepalive_out | |
6395 | + peer->notify_out + peer->refresh_out | |
6396 | + peer->dynamic_cap_out, | |
6397 | 0, 0, peer->obuf->count); | |
6398 | ||
6399 | vty_out (vty, "%8s", | |
6400 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); | |
6401 | ||
6402 | if (peer->status == Established) | |
6403 | { | |
6404 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
6405 | } | |
6406 | else | |
6407 | { | |
6408 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
6409 | vty_out (vty, " Idle (Admin)"); | |
6410 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
6411 | vty_out (vty, " Idle (PfxCt)"); | |
6412 | else | |
6413 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
6414 | } | |
6415 | ||
6416 | vty_out (vty, "%s", VTY_NEWLINE); | |
6417 | } | |
6418 | } | |
6419 | ||
6420 | if (count) | |
6421 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
6422 | count, VTY_NEWLINE); | |
6423 | else | |
6424 | vty_out (vty, "No %s neighbor is configured%s", | |
6425 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
6426 | return CMD_SUCCESS; | |
6427 | } | |
6428 | ||
6429 | int | |
fd79ac91 | 6430 | bgp_show_summary_vty (struct vty *vty, const char *name, |
6431 | afi_t afi, safi_t safi) | |
718e3744 | 6432 | { |
6433 | struct bgp *bgp; | |
6434 | ||
6435 | if (name) | |
6436 | { | |
6437 | bgp = bgp_lookup_by_name (name); | |
6438 | ||
6439 | if (! bgp) | |
6440 | { | |
6441 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
6442 | return CMD_WARNING; | |
6443 | } | |
6444 | ||
6445 | bgp_show_summary (vty, bgp, afi, safi); | |
6446 | return CMD_SUCCESS; | |
6447 | } | |
6448 | ||
6449 | bgp = bgp_get_default (); | |
6450 | ||
6451 | if (bgp) | |
6452 | bgp_show_summary (vty, bgp, afi, safi); | |
6453 | ||
6454 | return CMD_SUCCESS; | |
6455 | } | |
6456 | ||
6457 | /* `show ip bgp summary' commands. */ | |
6458 | DEFUN (show_ip_bgp_summary, | |
6459 | show_ip_bgp_summary_cmd, | |
6460 | "show ip bgp summary", | |
6461 | SHOW_STR | |
6462 | IP_STR | |
6463 | BGP_STR | |
6464 | "Summary of BGP neighbor status\n") | |
6465 | { | |
6466 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
6467 | } | |
6468 | ||
6469 | DEFUN (show_ip_bgp_instance_summary, | |
6470 | show_ip_bgp_instance_summary_cmd, | |
6471 | "show ip bgp view WORD summary", | |
6472 | SHOW_STR | |
6473 | IP_STR | |
6474 | BGP_STR | |
6475 | "BGP view\n" | |
6476 | "View name\n" | |
6477 | "Summary of BGP neighbor status\n") | |
6478 | { | |
6479 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
6480 | } | |
6481 | ||
6482 | DEFUN (show_ip_bgp_ipv4_summary, | |
6483 | show_ip_bgp_ipv4_summary_cmd, | |
6484 | "show ip bgp ipv4 (unicast|multicast) summary", | |
6485 | SHOW_STR | |
6486 | IP_STR | |
6487 | BGP_STR | |
6488 | "Address family\n" | |
6489 | "Address Family modifier\n" | |
6490 | "Address Family modifier\n" | |
6491 | "Summary of BGP neighbor status\n") | |
6492 | { | |
6493 | if (strncmp (argv[0], "m", 1) == 0) | |
6494 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
6495 | ||
6496 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
6497 | } | |
6498 | ||
6499 | DEFUN (show_ip_bgp_instance_ipv4_summary, | |
6500 | show_ip_bgp_instance_ipv4_summary_cmd, | |
6501 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", | |
6502 | SHOW_STR | |
6503 | IP_STR | |
6504 | BGP_STR | |
6505 | "BGP view\n" | |
6506 | "View name\n" | |
6507 | "Address family\n" | |
6508 | "Address Family modifier\n" | |
6509 | "Address Family modifier\n" | |
6510 | "Summary of BGP neighbor status\n") | |
6511 | { | |
6512 | if (strncmp (argv[1], "m", 1) == 0) | |
6513 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
6514 | else | |
6515 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
6516 | } | |
6517 | ||
6518 | DEFUN (show_ip_bgp_vpnv4_all_summary, | |
6519 | show_ip_bgp_vpnv4_all_summary_cmd, | |
6520 | "show ip bgp vpnv4 all summary", | |
6521 | SHOW_STR | |
6522 | IP_STR | |
6523 | BGP_STR | |
6524 | "Display VPNv4 NLRI specific information\n" | |
6525 | "Display information about all VPNv4 NLRIs\n" | |
6526 | "Summary of BGP neighbor status\n") | |
6527 | { | |
6528 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); | |
6529 | } | |
6530 | ||
6531 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
6532 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
6533 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", | |
6534 | SHOW_STR | |
6535 | IP_STR | |
6536 | BGP_STR | |
6537 | "Display VPNv4 NLRI specific information\n" | |
6538 | "Display information for a route distinguisher\n" | |
6539 | "VPN Route Distinguisher\n" | |
6540 | "Summary of BGP neighbor status\n") | |
6541 | { | |
6542 | int ret; | |
6543 | struct prefix_rd prd; | |
6544 | ||
6545 | ret = str2prefix_rd (argv[0], &prd); | |
6546 | if (! ret) | |
6547 | { | |
6548 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
6549 | return CMD_WARNING; | |
6550 | } | |
6551 | ||
6552 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); | |
6553 | } | |
6554 | ||
6555 | #ifdef HAVE_IPV6 | |
6556 | DEFUN (show_bgp_summary, | |
6557 | show_bgp_summary_cmd, | |
6558 | "show bgp summary", | |
6559 | SHOW_STR | |
6560 | BGP_STR | |
6561 | "Summary of BGP neighbor status\n") | |
6562 | { | |
6563 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
6564 | } | |
6565 | ||
6566 | DEFUN (show_bgp_instance_summary, | |
6567 | show_bgp_instance_summary_cmd, | |
6568 | "show bgp view WORD summary", | |
6569 | SHOW_STR | |
6570 | BGP_STR | |
6571 | "BGP view\n" | |
6572 | "View name\n" | |
6573 | "Summary of BGP neighbor status\n") | |
6574 | { | |
6575 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
6576 | } | |
6577 | ||
6578 | ALIAS (show_bgp_summary, | |
6579 | show_bgp_ipv6_summary_cmd, | |
6580 | "show bgp ipv6 summary", | |
6581 | SHOW_STR | |
6582 | BGP_STR | |
6583 | "Address family\n" | |
6584 | "Summary of BGP neighbor status\n") | |
6585 | ||
6586 | ALIAS (show_bgp_instance_summary, | |
6587 | show_bgp_instance_ipv6_summary_cmd, | |
6588 | "show bgp view WORD ipv6 summary", | |
6589 | SHOW_STR | |
6590 | BGP_STR | |
6591 | "BGP view\n" | |
6592 | "View name\n" | |
6593 | "Address family\n" | |
6594 | "Summary of BGP neighbor status\n") | |
6595 | ||
6596 | /* old command */ | |
6597 | DEFUN (show_ipv6_bgp_summary, | |
6598 | show_ipv6_bgp_summary_cmd, | |
6599 | "show ipv6 bgp summary", | |
6600 | SHOW_STR | |
6601 | IPV6_STR | |
6602 | BGP_STR | |
6603 | "Summary of BGP neighbor status\n") | |
6604 | { | |
6605 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
6606 | } | |
6607 | ||
6608 | /* old command */ | |
6609 | DEFUN (show_ipv6_mbgp_summary, | |
6610 | show_ipv6_mbgp_summary_cmd, | |
6611 | "show ipv6 mbgp summary", | |
6612 | SHOW_STR | |
6613 | IPV6_STR | |
6614 | MBGP_STR | |
6615 | "Summary of BGP neighbor status\n") | |
6616 | { | |
6617 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); | |
6618 | } | |
6619 | #endif /* HAVE_IPV6 */ | |
6620 | \f | |
fd79ac91 | 6621 | const char * |
538621f2 | 6622 | afi_safi_print (afi_t afi, safi_t safi) |
6623 | { | |
6624 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
6625 | return "IPv4 Unicast"; | |
6626 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
6627 | return "IPv4 Multicast"; | |
6628 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
6629 | return "VPNv4 Unicast"; | |
6630 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
6631 | return "IPv6 Unicast"; | |
6632 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
6633 | return "IPv6 Multicast"; | |
6634 | else | |
6635 | return "Unknown"; | |
6636 | } | |
6637 | ||
718e3744 | 6638 | /* Show BGP peer's information. */ |
6639 | enum show_type | |
6640 | { | |
6641 | show_all, | |
6642 | show_peer | |
6643 | }; | |
6644 | ||
6645 | void | |
6646 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, | |
6647 | afi_t afi, safi_t safi, | |
6648 | u_int16_t adv_smcap, u_int16_t adv_rmcap, | |
6649 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) | |
6650 | { | |
6651 | /* Send-Mode */ | |
6652 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
6653 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
6654 | { | |
6655 | vty_out (vty, " Send-mode: "); | |
6656 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
6657 | vty_out (vty, "advertised"); | |
6658 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
6659 | vty_out (vty, "%sreceived", | |
6660 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
6661 | ", " : ""); | |
6662 | vty_out (vty, "%s", VTY_NEWLINE); | |
6663 | } | |
6664 | ||
6665 | /* Receive-Mode */ | |
6666 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
6667 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
6668 | { | |
6669 | vty_out (vty, " Receive-mode: "); | |
6670 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
6671 | vty_out (vty, "advertised"); | |
6672 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
6673 | vty_out (vty, "%sreceived", | |
6674 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
6675 | ", " : ""); | |
6676 | vty_out (vty, "%s", VTY_NEWLINE); | |
6677 | } | |
6678 | } | |
6679 | ||
6680 | void | |
6681 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) | |
6682 | { | |
6683 | struct bgp_filter *filter; | |
6684 | char orf_pfx_name[BUFSIZ]; | |
6685 | int orf_pfx_count; | |
6686 | ||
6687 | filter = &p->filter[afi][safi]; | |
6688 | ||
538621f2 | 6689 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
718e3744 | 6690 | VTY_NEWLINE); |
538621f2 | 6691 | |
718e3744 | 6692 | if (p->af_group[afi][safi]) |
6693 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
6694 | ||
6695 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
6696 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
6697 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
6698 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
6699 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
6700 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
6701 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
6702 | ||
6703 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
6704 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
6705 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
6706 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
6707 | { | |
6708 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
6709 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
6710 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
6711 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
6712 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
6713 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
6714 | PEER_CAP_ORF_PREFIX_RM_RCV); | |
6715 | } | |
6716 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
6717 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
6718 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
6719 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
6720 | { | |
6721 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
6722 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
6723 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
6724 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
6725 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
6726 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
6727 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); | |
6728 | } | |
6729 | ||
6730 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
6731 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); | |
6732 | ||
6733 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
6734 | || orf_pfx_count) | |
6735 | { | |
6736 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
6737 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
6738 | vty_out (vty, " sent;"); | |
6739 | if (orf_pfx_count) | |
6740 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
6741 | vty_out (vty, "%s", VTY_NEWLINE); | |
6742 | } | |
6743 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
6744 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
6745 | ||
6746 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
6747 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
6748 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
6749 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
6750 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
6751 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
6752 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
6753 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); | |
6754 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) | |
6755 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
6756 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
6757 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
6758 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
6759 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
6760 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
6761 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
6762 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
6763 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
6764 | { | |
6765 | vty_out (vty, " Community attribute sent to this neighbor"); | |
6766 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
6767 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
538621f2 | 6768 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
718e3744 | 6769 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
538621f2 | 6770 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
718e3744 | 6771 | else |
538621f2 | 6772 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
718e3744 | 6773 | } |
6774 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
6775 | { | |
6776 | vty_out (vty, " Default information originate,"); | |
6777 | ||
6778 | if (p->default_rmap[afi][safi].name) | |
6779 | vty_out (vty, " default route-map %s%s,", | |
6780 | p->default_rmap[afi][safi].map ? "*" : "", | |
6781 | p->default_rmap[afi][safi].name); | |
6782 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) | |
6783 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
6784 | else | |
6785 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
6786 | } | |
6787 | ||
6788 | if (filter->plist[FILTER_IN].name | |
6789 | || filter->dlist[FILTER_IN].name | |
6790 | || filter->aslist[FILTER_IN].name | |
fee0f4c6 | 6791 | || filter->map[RMAP_IN].name) |
718e3744 | 6792 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
6793 | if (filter->plist[FILTER_OUT].name | |
6794 | || filter->dlist[FILTER_OUT].name | |
6795 | || filter->aslist[FILTER_OUT].name | |
fee0f4c6 | 6796 | || filter->map[RMAP_OUT].name |
718e3744 | 6797 | || filter->usmap.name) |
6798 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
fee0f4c6 | 6799 | if (filter->map[RMAP_IMPORT].name) |
6800 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
6801 | if (filter->map[RMAP_EXPORT].name) | |
6802 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
718e3744 | 6803 | |
6804 | /* prefix-list */ | |
6805 | if (filter->plist[FILTER_IN].name) | |
6806 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
6807 | filter->plist[FILTER_IN].plist ? "*" : "", | |
6808 | filter->plist[FILTER_IN].name, | |
6809 | VTY_NEWLINE); | |
6810 | if (filter->plist[FILTER_OUT].name) | |
6811 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
6812 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
6813 | filter->plist[FILTER_OUT].name, | |
6814 | VTY_NEWLINE); | |
6815 | ||
6816 | /* distribute-list */ | |
6817 | if (filter->dlist[FILTER_IN].name) | |
6818 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
6819 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
6820 | filter->dlist[FILTER_IN].name, | |
6821 | VTY_NEWLINE); | |
6822 | if (filter->dlist[FILTER_OUT].name) | |
6823 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
6824 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
6825 | filter->dlist[FILTER_OUT].name, | |
6826 | VTY_NEWLINE); | |
6827 | ||
6828 | /* filter-list. */ | |
6829 | if (filter->aslist[FILTER_IN].name) | |
6830 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
6831 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
6832 | filter->aslist[FILTER_IN].name, | |
6833 | VTY_NEWLINE); | |
6834 | if (filter->aslist[FILTER_OUT].name) | |
6835 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
6836 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
6837 | filter->aslist[FILTER_OUT].name, | |
6838 | VTY_NEWLINE); | |
6839 | ||
6840 | /* route-map. */ | |
fee0f4c6 | 6841 | if (filter->map[RMAP_IN].name) |
718e3744 | 6842 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
fee0f4c6 | 6843 | filter->map[RMAP_IN].map ? "*" : "", |
6844 | filter->map[RMAP_IN].name, | |
718e3744 | 6845 | VTY_NEWLINE); |
fee0f4c6 | 6846 | if (filter->map[RMAP_OUT].name) |
718e3744 | 6847 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
fee0f4c6 | 6848 | filter->map[RMAP_OUT].map ? "*" : "", |
6849 | filter->map[RMAP_OUT].name, | |
6850 | VTY_NEWLINE); | |
6851 | if (filter->map[RMAP_IMPORT].name) | |
6852 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
6853 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
6854 | filter->map[RMAP_IMPORT].name, | |
6855 | VTY_NEWLINE); | |
6856 | if (filter->map[RMAP_EXPORT].name) | |
6857 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
6858 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
6859 | filter->map[RMAP_EXPORT].name, | |
718e3744 | 6860 | VTY_NEWLINE); |
6861 | ||
6862 | /* unsuppress-map */ | |
6863 | if (filter->usmap.name) | |
6864 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
6865 | filter->usmap.map ? "*" : "", | |
6866 | filter->usmap.name, VTY_NEWLINE); | |
6867 | ||
6868 | /* Receive prefix count */ | |
e0701b79 | 6869 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
6870 | ||
718e3744 | 6871 | /* Maximum prefix */ |
6872 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
6873 | { | |
e0701b79 | 6874 | vty_out (vty, " maximum limit %ld%s%s", p->pmax[afi][safi], |
718e3744 | 6875 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
e0701b79 | 6876 | ? " (warning-only)" : "", VTY_NEWLINE); |
6877 | vty_out (vty, " Threshold for warning message %d%%%s", p->pmax_threshold [afi][safi], | |
6878 | VTY_NEWLINE); | |
718e3744 | 6879 | } |
718e3744 | 6880 | |
6881 | vty_out (vty, "%s", VTY_NEWLINE); | |
6882 | } | |
6883 | ||
6884 | void | |
6885 | bgp_show_peer (struct vty *vty, struct peer *p) | |
6886 | { | |
6887 | struct bgp *bgp; | |
6888 | char buf1[BUFSIZ]; | |
6889 | char timebuf[BGP_UPTIME_LEN]; | |
538621f2 | 6890 | afi_t afi; |
6891 | safi_t safi; | |
718e3744 | 6892 | |
6893 | bgp = p->bgp; | |
6894 | ||
6895 | /* Configured IP address. */ | |
6896 | vty_out (vty, "BGP neighbor is %s, ", p->host); | |
6897 | vty_out (vty, "remote AS %d, ", p->as); | |
6898 | vty_out (vty, "local AS %d%s, ", | |
6899 | p->change_local_as ? p->change_local_as : p->local_as, | |
6900 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
6901 | " no-prepend" : ""); | |
6902 | vty_out (vty, "%s link%s", | |
6903 | p->as == p->local_as ? "internal" : "external", | |
6904 | VTY_NEWLINE); | |
6905 | ||
6906 | /* Description. */ | |
6907 | if (p->desc) | |
6908 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
6909 | ||
6910 | /* Peer-group */ | |
6911 | if (p->group) | |
6912 | vty_out (vty, " Member of peer-group %s for session parameters%s", | |
6913 | p->group->name, VTY_NEWLINE); | |
6914 | ||
6915 | /* Administrative shutdown. */ | |
6916 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
6917 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
6918 | ||
6919 | /* BGP Version. */ | |
6920 | vty_out (vty, " BGP version 4"); | |
6921 | if (p->version == BGP_VERSION_MP_4_DRAFT_00) | |
6922 | vty_out (vty, "(with draft-00 verion of multiporotocol extension)"); | |
6923 | vty_out (vty, ", remote router ID %s%s", | |
6924 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
6925 | VTY_NEWLINE); | |
6926 | ||
6927 | /* Confederation */ | |
e0701b79 | 6928 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
6929 | && bgp_confederation_peers_check (bgp, p->as)) | |
718e3744 | 6930 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
6931 | ||
6932 | /* Status. */ | |
6933 | vty_out (vty, " BGP state = %s", | |
6934 | LOOKUP (bgp_status_msg, p->status)); | |
6935 | if (p->status == Established) | |
6936 | vty_out (vty, ", up for %8s", | |
6937 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); | |
6938 | vty_out (vty, "%s", VTY_NEWLINE); | |
6939 | ||
6940 | /* read timer */ | |
6941 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); | |
6942 | ||
6943 | /* Configured timer values. */ | |
6944 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", | |
6945 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
6946 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
6947 | { | |
6948 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
6949 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
6950 | p->keepalive, VTY_NEWLINE); | |
6951 | } | |
6952 | ||
6953 | /* Capability. */ | |
6954 | if (p->status == Established) | |
6955 | { | |
538621f2 | 6956 | if (p->cap |
718e3744 | 6957 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
6958 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
6959 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
6960 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
6961 | #ifdef HAVE_IPV6 | |
6962 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
6963 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
6964 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
6965 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
6966 | #endif /* HAVE_IPV6 */ | |
6967 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
6968 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
6969 | { | |
6970 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
6971 | ||
6972 | /* Dynamic */ | |
6973 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
6974 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
6975 | { | |
6976 | vty_out (vty, " Dynamic:"); | |
6977 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
6978 | vty_out (vty, " advertised"); | |
6979 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
538621f2 | 6980 | vty_out (vty, " %sreceived", |
6981 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
718e3744 | 6982 | vty_out (vty, "%s", VTY_NEWLINE); |
6983 | } | |
6984 | ||
6985 | /* Route Refresh */ | |
6986 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
6987 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
6988 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
6989 | { | |
6990 | vty_out (vty, " Route refresh:"); | |
6991 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
6992 | vty_out (vty, " advertised"); | |
6993 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
6994 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
538621f2 | 6995 | vty_out (vty, " %sreceived(%s)", |
6996 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
6997 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
6998 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
6999 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
718e3744 | 7000 | |
718e3744 | 7001 | vty_out (vty, "%s", VTY_NEWLINE); |
7002 | } | |
538621f2 | 7003 | |
7004 | /* Multiprotocol Extensions */ | |
7005 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7006 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7007 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
718e3744 | 7008 | { |
538621f2 | 7009 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
7010 | if (p->afc_adv[afi][safi]) | |
7011 | vty_out (vty, " advertised"); | |
7012 | if (p->afc_recv[afi][safi]) | |
7013 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
7014 | vty_out (vty, "%s", VTY_NEWLINE); | |
7015 | } | |
7016 | ||
7017 | /* Gracefull Restart */ | |
7018 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
7019 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 7020 | { |
538621f2 | 7021 | vty_out (vty, " Graceful Restart Capabilty:"); |
7022 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 7023 | vty_out (vty, " advertised"); |
538621f2 | 7024 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
7025 | vty_out (vty, " %sreceived", | |
7026 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
718e3744 | 7027 | vty_out (vty, "%s", VTY_NEWLINE); |
538621f2 | 7028 | |
7029 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
718e3744 | 7030 | { |
538621f2 | 7031 | int restart_af_count = 0; |
7032 | ||
7033 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
7034 | p->restart_time_rcv, VTY_NEWLINE); | |
7035 | vty_out (vty, " Address families preserved by peer:%s ", VTY_NEWLINE); | |
7036 | ||
7037 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7038 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7039 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
7040 | { | |
7041 | vty_out (vty, "%s%s", restart_af_count ? ", " : "", | |
7042 | afi_safi_print (afi, safi)); | |
7043 | restart_af_count++; | |
7044 | } | |
7045 | if (! restart_af_count) | |
7046 | vty_out (vty, "none"); | |
7047 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 7048 | } |
718e3744 | 7049 | } |
718e3744 | 7050 | } |
7051 | } | |
7052 | ||
7053 | /* Packet counts. */ | |
7054 | vty_out(vty, " Received %d messages, %d notifications, %d in queue%s", | |
7055 | p->open_in + p->update_in + p->keepalive_in + p->refresh_in | |
7056 | + p->dynamic_cap_in, p->notify_in, 0, VTY_NEWLINE); | |
7057 | vty_out(vty, " Sent %d messages, %d notifications, %ld in queue%s", | |
7058 | p->open_out + p->update_out + p->keepalive_out + p->refresh_out | |
7059 | + p->dynamic_cap_out, p->notify_out, p->obuf->count, VTY_NEWLINE); | |
7060 | vty_out(vty, " Route refresh request: received %d, sent %d%s", | |
7061 | p->refresh_in, p->refresh_out, VTY_NEWLINE); | |
7062 | ||
7063 | /* advertisement-interval */ | |
7064 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
7065 | p->v_routeadv, VTY_NEWLINE); | |
7066 | ||
7067 | /* Update-source. */ | |
7068 | if (p->update_if || p->update_source) | |
7069 | { | |
7070 | vty_out (vty, " Update source is "); | |
7071 | if (p->update_if) | |
7072 | vty_out (vty, "%s", p->update_if); | |
7073 | else if (p->update_source) | |
7074 | vty_out (vty, "%s", | |
7075 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
7076 | vty_out (vty, "%s", VTY_NEWLINE); | |
7077 | } | |
7078 | ||
7079 | /* Default weight */ | |
7080 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
7081 | vty_out (vty, " Default weight %d%s", p->weight, | |
7082 | VTY_NEWLINE); | |
7083 | ||
7084 | vty_out (vty, "%s", VTY_NEWLINE); | |
7085 | ||
7086 | /* Address Family Information */ | |
538621f2 | 7087 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
7088 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7089 | if (p->afc[afi][safi]) | |
7090 | bgp_show_peer_afi (vty, p, afi, safi); | |
718e3744 | 7091 | |
7092 | vty_out (vty, " Connections established %d; dropped %d%s", | |
7093 | p->established, p->dropped, | |
7094 | VTY_NEWLINE); | |
7095 | ||
e0701b79 | 7096 | if (! p->dropped) |
7097 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
7098 | else | |
7099 | vty_out (vty, " Last reset %s, due to %s%s", | |
7100 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), | |
7101 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
848973c7 | 7102 | |
718e3744 | 7103 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
7104 | { | |
7105 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
7106 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
7107 | p->host, VTY_NEWLINE); | |
7108 | } | |
7109 | ||
7110 | /* EBGP Multihop */ | |
7111 | if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1) | |
7112 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
7113 | p->ttl, VTY_NEWLINE); | |
7114 | ||
7115 | /* Local address. */ | |
7116 | if (p->su_local) | |
7117 | { | |
7118 | vty_out (vty, "Local host: %s, Local port: %d%s%s", | |
7119 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
7120 | ntohs (p->su_local->sin.sin_port), | |
7121 | CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE) ? | |
7122 | ", passive-mode" : "", | |
7123 | VTY_NEWLINE); | |
7124 | } | |
7125 | ||
7126 | /* Remote address. */ | |
7127 | if (p->su_remote) | |
7128 | { | |
7129 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
7130 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), | |
7131 | ntohs (p->su_remote->sin.sin_port), | |
7132 | VTY_NEWLINE); | |
7133 | } | |
7134 | ||
7135 | /* Nexthop display. */ | |
7136 | if (p->su_local) | |
7137 | { | |
7138 | vty_out (vty, "Nexthop: %s%s", | |
7139 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
7140 | VTY_NEWLINE); | |
7141 | #ifdef HAVE_IPV6 | |
7142 | vty_out (vty, "Nexthop global: %s%s", | |
7143 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
7144 | VTY_NEWLINE); | |
7145 | vty_out (vty, "Nexthop local: %s%s", | |
7146 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
7147 | VTY_NEWLINE); | |
7148 | vty_out (vty, "BGP connection: %s%s", | |
7149 | p->shared_network ? "shared network" : "non shared network", | |
7150 | VTY_NEWLINE); | |
7151 | #endif /* HAVE_IPV6 */ | |
7152 | } | |
7153 | ||
7154 | /* Timer information. */ | |
7155 | if (p->t_start) | |
7156 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
7157 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
7158 | if (p->t_connect) | |
7159 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
7160 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
7161 | ||
7162 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
7163 | p->t_read ? "on" : "off", | |
7164 | p->t_write ? "on" : "off", | |
7165 | VTY_NEWLINE); | |
7166 | ||
7167 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
7168 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
7169 | bgp_capability_vty_out (vty, p); | |
7170 | ||
7171 | vty_out (vty, "%s", VTY_NEWLINE); | |
7172 | } | |
7173 | ||
7174 | int | |
7175 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, | |
7176 | enum show_type type, union sockunion *su) | |
7177 | { | |
7178 | struct listnode *nn; | |
7179 | struct peer *peer; | |
7180 | int find = 0; | |
7181 | ||
7182 | LIST_LOOP (bgp->peer, peer, nn) | |
7183 | { | |
7184 | switch (type) | |
7185 | { | |
7186 | case show_all: | |
7187 | bgp_show_peer (vty, peer); | |
7188 | break; | |
7189 | case show_peer: | |
7190 | if (sockunion_same (&peer->su, su)) | |
7191 | { | |
7192 | find = 1; | |
7193 | bgp_show_peer (vty, peer); | |
7194 | } | |
7195 | break; | |
7196 | } | |
7197 | } | |
7198 | ||
7199 | if (type == show_peer && ! find) | |
7200 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
7201 | ||
7202 | return CMD_SUCCESS; | |
7203 | } | |
7204 | ||
7205 | int | |
fd79ac91 | 7206 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
7207 | enum show_type type, const char *ip_str) | |
718e3744 | 7208 | { |
7209 | int ret; | |
7210 | struct bgp *bgp; | |
7211 | union sockunion su; | |
7212 | ||
7213 | if (ip_str) | |
7214 | { | |
7215 | ret = str2sockunion (ip_str, &su); | |
7216 | if (ret < 0) | |
7217 | { | |
7218 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); | |
7219 | return CMD_WARNING; | |
7220 | } | |
7221 | } | |
7222 | ||
7223 | if (name) | |
7224 | { | |
7225 | bgp = bgp_lookup_by_name (name); | |
7226 | ||
7227 | if (! bgp) | |
7228 | { | |
7229 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
7230 | return CMD_WARNING; | |
7231 | } | |
7232 | ||
7233 | bgp_show_neighbor (vty, bgp, type, &su); | |
7234 | ||
7235 | return CMD_SUCCESS; | |
7236 | } | |
7237 | ||
7238 | bgp = bgp_get_default (); | |
7239 | ||
7240 | if (bgp) | |
7241 | bgp_show_neighbor (vty, bgp, type, &su); | |
7242 | ||
7243 | return CMD_SUCCESS; | |
7244 | } | |
7245 | ||
7246 | /* "show ip bgp neighbors" commands. */ | |
7247 | DEFUN (show_ip_bgp_neighbors, | |
7248 | show_ip_bgp_neighbors_cmd, | |
7249 | "show ip bgp neighbors", | |
7250 | SHOW_STR | |
7251 | IP_STR | |
7252 | BGP_STR | |
7253 | "Detailed information on TCP and BGP neighbor connections\n") | |
7254 | { | |
7255 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); | |
7256 | } | |
7257 | ||
7258 | ALIAS (show_ip_bgp_neighbors, | |
7259 | show_ip_bgp_ipv4_neighbors_cmd, | |
7260 | "show ip bgp ipv4 (unicast|multicast) neighbors", | |
7261 | SHOW_STR | |
7262 | IP_STR | |
7263 | BGP_STR | |
7264 | "Address family\n" | |
7265 | "Address Family modifier\n" | |
7266 | "Address Family modifier\n" | |
7267 | "Detailed information on TCP and BGP neighbor connections\n") | |
7268 | ||
7269 | ALIAS (show_ip_bgp_neighbors, | |
7270 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
7271 | "show ip bgp vpnv4 all neighbors", | |
7272 | SHOW_STR | |
7273 | IP_STR | |
7274 | BGP_STR | |
7275 | "Display VPNv4 NLRI specific information\n" | |
7276 | "Display information about all VPNv4 NLRIs\n" | |
7277 | "Detailed information on TCP and BGP neighbor connections\n") | |
7278 | ||
7279 | ALIAS (show_ip_bgp_neighbors, | |
7280 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
7281 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", | |
7282 | SHOW_STR | |
7283 | IP_STR | |
7284 | BGP_STR | |
7285 | "Display VPNv4 NLRI specific information\n" | |
7286 | "Display information for a route distinguisher\n" | |
7287 | "VPN Route Distinguisher\n" | |
7288 | "Detailed information on TCP and BGP neighbor connections\n") | |
7289 | ||
7290 | ALIAS (show_ip_bgp_neighbors, | |
7291 | show_bgp_neighbors_cmd, | |
7292 | "show bgp neighbors", | |
7293 | SHOW_STR | |
7294 | BGP_STR | |
7295 | "Detailed information on TCP and BGP neighbor connections\n") | |
7296 | ||
7297 | ALIAS (show_ip_bgp_neighbors, | |
7298 | show_bgp_ipv6_neighbors_cmd, | |
7299 | "show bgp ipv6 neighbors", | |
7300 | SHOW_STR | |
7301 | BGP_STR | |
7302 | "Address family\n" | |
7303 | "Detailed information on TCP and BGP neighbor connections\n") | |
7304 | ||
7305 | DEFUN (show_ip_bgp_neighbors_peer, | |
7306 | show_ip_bgp_neighbors_peer_cmd, | |
7307 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", | |
7308 | SHOW_STR | |
7309 | IP_STR | |
7310 | BGP_STR | |
7311 | "Detailed information on TCP and BGP neighbor connections\n" | |
7312 | "Neighbor to display information about\n" | |
7313 | "Neighbor to display information about\n") | |
7314 | { | |
7315 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); | |
7316 | } | |
7317 | ||
7318 | ALIAS (show_ip_bgp_neighbors_peer, | |
7319 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
7320 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", | |
7321 | SHOW_STR | |
7322 | IP_STR | |
7323 | BGP_STR | |
7324 | "Address family\n" | |
7325 | "Address Family modifier\n" | |
7326 | "Address Family modifier\n" | |
7327 | "Detailed information on TCP and BGP neighbor connections\n" | |
7328 | "Neighbor to display information about\n" | |
7329 | "Neighbor to display information about\n") | |
7330 | ||
7331 | ALIAS (show_ip_bgp_neighbors_peer, | |
7332 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
7333 | "show ip bgp vpnv4 all neighbors A.B.C.D", | |
7334 | SHOW_STR | |
7335 | IP_STR | |
7336 | BGP_STR | |
7337 | "Display VPNv4 NLRI specific information\n" | |
7338 | "Display information about all VPNv4 NLRIs\n" | |
7339 | "Detailed information on TCP and BGP neighbor connections\n" | |
7340 | "Neighbor to display information about\n") | |
7341 | ||
7342 | ALIAS (show_ip_bgp_neighbors_peer, | |
7343 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
7344 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", | |
7345 | SHOW_STR | |
7346 | IP_STR | |
7347 | BGP_STR | |
7348 | "Display VPNv4 NLRI specific information\n" | |
7349 | "Display information about all VPNv4 NLRIs\n" | |
7350 | "Detailed information on TCP and BGP neighbor connections\n" | |
7351 | "Neighbor to display information about\n") | |
7352 | ||
7353 | ALIAS (show_ip_bgp_neighbors_peer, | |
7354 | show_bgp_neighbors_peer_cmd, | |
7355 | "show bgp neighbors (A.B.C.D|X:X::X:X)", | |
7356 | SHOW_STR | |
7357 | BGP_STR | |
7358 | "Detailed information on TCP and BGP neighbor connections\n" | |
7359 | "Neighbor to display information about\n" | |
7360 | "Neighbor to display information about\n") | |
7361 | ||
7362 | ALIAS (show_ip_bgp_neighbors_peer, | |
7363 | show_bgp_ipv6_neighbors_peer_cmd, | |
7364 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", | |
7365 | SHOW_STR | |
7366 | BGP_STR | |
7367 | "Address family\n" | |
7368 | "Detailed information on TCP and BGP neighbor connections\n" | |
7369 | "Neighbor to display information about\n" | |
7370 | "Neighbor to display information about\n") | |
7371 | ||
7372 | DEFUN (show_ip_bgp_instance_neighbors, | |
7373 | show_ip_bgp_instance_neighbors_cmd, | |
7374 | "show ip bgp view WORD neighbors", | |
7375 | SHOW_STR | |
7376 | IP_STR | |
7377 | BGP_STR | |
7378 | "BGP view\n" | |
7379 | "View name\n" | |
7380 | "Detailed information on TCP and BGP neighbor connections\n") | |
7381 | { | |
7382 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); | |
7383 | } | |
7384 | ||
bb46e94f | 7385 | ALIAS (show_ip_bgp_instance_neighbors, |
7386 | show_bgp_instance_neighbors_cmd, | |
7387 | "show bgp view WORD neighbors", | |
7388 | SHOW_STR | |
7389 | BGP_STR | |
7390 | "BGP view\n" | |
7391 | "View name\n" | |
7392 | "Detailed information on TCP and BGP neighbor connections\n") | |
7393 | ||
7394 | ALIAS (show_ip_bgp_instance_neighbors, | |
7395 | show_bgp_instance_ipv6_neighbors_cmd, | |
7396 | "show bgp view WORD ipv6 neighbors", | |
7397 | SHOW_STR | |
7398 | BGP_STR | |
7399 | "BGP view\n" | |
7400 | "View name\n" | |
7401 | "Address family\n" | |
7402 | "Detailed information on TCP and BGP neighbor connections\n") | |
7403 | ||
718e3744 | 7404 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
7405 | show_ip_bgp_instance_neighbors_peer_cmd, | |
7406 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", | |
7407 | SHOW_STR | |
7408 | IP_STR | |
7409 | BGP_STR | |
7410 | "BGP view\n" | |
7411 | "View name\n" | |
7412 | "Detailed information on TCP and BGP neighbor connections\n" | |
7413 | "Neighbor to display information about\n" | |
7414 | "Neighbor to display information about\n") | |
7415 | { | |
7416 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); | |
7417 | } | |
bb46e94f | 7418 | |
7419 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
7420 | show_bgp_instance_neighbors_peer_cmd, | |
7421 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", | |
7422 | SHOW_STR | |
7423 | BGP_STR | |
7424 | "BGP view\n" | |
7425 | "View name\n" | |
7426 | "Detailed information on TCP and BGP neighbor connections\n" | |
7427 | "Neighbor to display information about\n" | |
7428 | "Neighbor to display information about\n") | |
7429 | ||
7430 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
7431 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
7432 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", | |
7433 | SHOW_STR | |
7434 | BGP_STR | |
7435 | "BGP view\n" | |
7436 | "View name\n" | |
7437 | "Address family\n" | |
7438 | "Detailed information on TCP and BGP neighbor connections\n" | |
7439 | "Neighbor to display information about\n" | |
7440 | "Neighbor to display information about\n") | |
7441 | \f | |
718e3744 | 7442 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
7443 | paths' and `show ip mbgp paths'. Those functions results are the | |
7444 | same.*/ | |
7445 | DEFUN (show_ip_bgp_paths, | |
7446 | show_ip_bgp_paths_cmd, | |
7447 | "show ip bgp paths", | |
7448 | SHOW_STR | |
7449 | IP_STR | |
7450 | BGP_STR | |
7451 | "Path information\n") | |
7452 | { | |
7453 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
7454 | aspath_print_all_vty (vty); | |
7455 | return CMD_SUCCESS; | |
7456 | } | |
7457 | ||
7458 | DEFUN (show_ip_bgp_ipv4_paths, | |
7459 | show_ip_bgp_ipv4_paths_cmd, | |
7460 | "show ip bgp ipv4 (unicast|multicast) paths", | |
7461 | SHOW_STR | |
7462 | IP_STR | |
7463 | BGP_STR | |
7464 | "Address family\n" | |
7465 | "Address Family modifier\n" | |
7466 | "Address Family modifier\n" | |
7467 | "Path information\n") | |
7468 | { | |
7469 | vty_out (vty, "Address Refcnt Path\r\n"); | |
7470 | aspath_print_all_vty (vty); | |
7471 | ||
7472 | return CMD_SUCCESS; | |
7473 | } | |
7474 | \f | |
7475 | #include "hash.h" | |
7476 | ||
7477 | void | |
7478 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) | |
7479 | { | |
7480 | struct community *com; | |
7481 | ||
7482 | com = (struct community *) backet->data; | |
7483 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
7484 | community_str (com), VTY_NEWLINE); | |
7485 | } | |
7486 | ||
7487 | /* Show BGP's community internal data. */ | |
7488 | DEFUN (show_ip_bgp_community_info, | |
7489 | show_ip_bgp_community_info_cmd, | |
7490 | "show ip bgp community-info", | |
7491 | SHOW_STR | |
7492 | IP_STR | |
7493 | BGP_STR | |
7494 | "List all bgp community information\n") | |
7495 | { | |
7496 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
7497 | ||
7498 | hash_iterate (community_hash (), | |
7499 | (void (*) (struct hash_backet *, void *)) | |
7500 | community_show_all_iterator, | |
7501 | vty); | |
7502 | ||
7503 | return CMD_SUCCESS; | |
7504 | } | |
7505 | ||
7506 | DEFUN (show_ip_bgp_attr_info, | |
7507 | show_ip_bgp_attr_info_cmd, | |
7508 | "show ip bgp attribute-info", | |
7509 | SHOW_STR | |
7510 | IP_STR | |
7511 | BGP_STR | |
7512 | "List all bgp attribute information\n") | |
7513 | { | |
7514 | attr_show_all (vty); | |
7515 | return CMD_SUCCESS; | |
7516 | } | |
7517 | \f | |
fee0f4c6 | 7518 | int |
7519 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, | |
7520 | afi_t afi, safi_t safi) | |
7521 | { | |
7522 | char timebuf[BGP_UPTIME_LEN]; | |
7523 | char rmbuf[14]; | |
fd79ac91 | 7524 | const char *rmname; |
fee0f4c6 | 7525 | struct peer *peer; |
7526 | struct listnode *nn; | |
7527 | int len; | |
7528 | int count = 0; | |
7529 | ||
7530 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
7531 | { | |
7532 | LIST_LOOP (rsclient->group->peer, peer, nn) | |
7533 | { | |
7534 | count++; | |
7535 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
7536 | } | |
7537 | return count; | |
7538 | } | |
7539 | ||
7540 | len = vty_out (vty, "%s", rsclient->host); | |
7541 | len = 16 - len; | |
7542 | ||
7543 | if (len < 1) | |
7544 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
7545 | else | |
7546 | vty_out (vty, "%*s", len, " "); | |
7547 | ||
7548 | switch (rsclient->version) | |
7549 | { | |
7550 | case BGP_VERSION_4: | |
7551 | vty_out (vty, "4 "); | |
7552 | break; | |
7553 | case BGP_VERSION_MP_4_DRAFT_00: | |
7554 | vty_out (vty, "4-"); | |
7555 | break; | |
7556 | } | |
7557 | ||
7558 | vty_out (vty, "%5d ", rsclient->as); | |
7559 | ||
7560 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
7561 | if ( rmname && strlen (rmname) > 13 ) | |
7562 | { | |
7563 | sprintf (rmbuf, "%13s", "..."); | |
7564 | rmname = strncpy (rmbuf, rmname, 10); | |
7565 | } | |
7566 | else if (! rmname) | |
7567 | rmname = "<none>"; | |
7568 | vty_out (vty, " %13s ", rmname); | |
7569 | ||
7570 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
7571 | if ( rmname && strlen (rmname) > 13 ) | |
7572 | { | |
7573 | sprintf (rmbuf, "%13s", "..."); | |
7574 | rmname = strncpy (rmbuf, rmname, 10); | |
7575 | } | |
7576 | else if (! rmname) | |
7577 | rmname = "<none>"; | |
7578 | vty_out (vty, " %13s ", rmname); | |
7579 | ||
7580 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); | |
7581 | ||
7582 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
7583 | vty_out (vty, " Idle (Admin)"); | |
7584 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
7585 | vty_out (vty, " Idle (PfxCt)"); | |
7586 | else | |
7587 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
7588 | ||
7589 | vty_out (vty, "%s", VTY_NEWLINE); | |
7590 | ||
7591 | return 1; | |
7592 | } | |
7593 | ||
7594 | int | |
fd79ac91 | 7595 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
7596 | afi_t afi, safi_t safi) | |
fee0f4c6 | 7597 | { |
7598 | struct peer *peer; | |
7599 | struct listnode *nn; | |
7600 | int count = 0; | |
7601 | ||
7602 | /* Header string for each address family. */ | |
7603 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
7604 | ||
7605 | LIST_LOOP (bgp->rsclient, peer, nn) | |
7606 | { | |
7607 | if (peer->afc[afi][safi] && | |
7608 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
7609 | { | |
7610 | if (! count) | |
7611 | { | |
7612 | vty_out (vty, | |
7613 | "Route Server's BGP router identifier %s%s", | |
7614 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
7615 | vty_out (vty, | |
7616 | "Route Server's local AS number %d%s", bgp->as, | |
7617 | VTY_NEWLINE); | |
7618 | ||
7619 | vty_out (vty, "%s", VTY_NEWLINE); | |
7620 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
7621 | } | |
7622 | ||
7623 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
7624 | } | |
7625 | } | |
7626 | ||
7627 | if (count) | |
7628 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
7629 | count, VTY_NEWLINE); | |
7630 | else | |
7631 | vty_out (vty, "No %s Route Server Client is configured%s", | |
7632 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
7633 | ||
7634 | return CMD_SUCCESS; | |
7635 | } | |
7636 | ||
7637 | int | |
fd79ac91 | 7638 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
7639 | afi_t afi, safi_t safi) | |
fee0f4c6 | 7640 | { |
7641 | struct bgp *bgp; | |
7642 | ||
7643 | if (name) | |
7644 | { | |
7645 | bgp = bgp_lookup_by_name (name); | |
7646 | ||
7647 | if (! bgp) | |
7648 | { | |
7649 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
7650 | return CMD_WARNING; | |
7651 | } | |
7652 | ||
7653 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
7654 | return CMD_SUCCESS; | |
7655 | } | |
7656 | ||
7657 | bgp = bgp_get_default (); | |
7658 | ||
7659 | if (bgp) | |
7660 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
7661 | ||
7662 | return CMD_SUCCESS; | |
7663 | } | |
7664 | ||
7665 | /* 'show bgp rsclient' commands. */ | |
7666 | DEFUN (show_ip_bgp_rsclient_summary, | |
7667 | show_ip_bgp_rsclient_summary_cmd, | |
7668 | "show ip bgp rsclient summary", | |
7669 | SHOW_STR | |
7670 | IP_STR | |
7671 | BGP_STR | |
7672 | "Information about Route Server Clients\n" | |
7673 | "Summary of all Route Server Clients\n") | |
7674 | { | |
7675 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
7676 | } | |
7677 | ||
7678 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
7679 | show_ip_bgp_instance_rsclient_summary_cmd, | |
7680 | "show ip bgp view WORD rsclient summary", | |
7681 | SHOW_STR | |
7682 | IP_STR | |
7683 | BGP_STR | |
7684 | "BGP view\n" | |
7685 | "View name\n" | |
7686 | "Information about Route Server Clients\n" | |
7687 | "Summary of all Route Server Clients\n") | |
7688 | { | |
7689 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
7690 | } | |
7691 | ||
7692 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
7693 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
7694 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
7695 | SHOW_STR | |
7696 | IP_STR | |
7697 | BGP_STR | |
7698 | "Address family\n" | |
7699 | "Address Family modifier\n" | |
7700 | "Address Family modifier\n" | |
7701 | "Information about Route Server Clients\n" | |
7702 | "Summary of all Route Server Clients\n") | |
7703 | { | |
7704 | if (strncmp (argv[0], "m", 1) == 0) | |
7705 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
7706 | ||
7707 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
7708 | } | |
7709 | ||
7710 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
7711 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
7712 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
7713 | SHOW_STR | |
7714 | IP_STR | |
7715 | BGP_STR | |
7716 | "BGP view\n" | |
7717 | "View name\n" | |
7718 | "Address family\n" | |
7719 | "Address Family modifier\n" | |
7720 | "Address Family modifier\n" | |
7721 | "Information about Route Server Clients\n" | |
7722 | "Summary of all Route Server Clients\n") | |
7723 | { | |
7724 | if (strncmp (argv[1], "m", 1) == 0) | |
7725 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
7726 | ||
7727 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
7728 | } | |
7729 | ||
7730 | #ifdef HAVE_IPV6 | |
7731 | DEFUN (show_bgp_rsclient_summary, | |
7732 | show_bgp_rsclient_summary_cmd, | |
7733 | "show bgp rsclient summary", | |
7734 | SHOW_STR | |
7735 | BGP_STR | |
7736 | "Information about Route Server Clients\n" | |
7737 | "Summary of all Route Server Clients\n") | |
7738 | { | |
7739 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
7740 | } | |
7741 | ||
7742 | DEFUN (show_bgp_instance_rsclient_summary, | |
7743 | show_bgp_instance_rsclient_summary_cmd, | |
7744 | "show bgp view WORD rsclient summary", | |
7745 | SHOW_STR | |
7746 | BGP_STR | |
7747 | "BGP view\n" | |
7748 | "View name\n" | |
7749 | "Information about Route Server Clients\n" | |
7750 | "Summary of all Route Server Clients\n") | |
7751 | { | |
7752 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
7753 | } | |
7754 | ||
7755 | ALIAS (show_bgp_rsclient_summary, | |
7756 | show_bgp_ipv6_rsclient_summary_cmd, | |
7757 | "show bgp ipv6 rsclient summary", | |
7758 | SHOW_STR | |
7759 | BGP_STR | |
7760 | "Address family\n" | |
7761 | "Information about Route Server Clients\n" | |
7762 | "Summary of all Route Server Clients\n") | |
7763 | ||
7764 | ALIAS (show_bgp_instance_rsclient_summary, | |
7765 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
7766 | "show bgp view WORD ipv6 rsclient summary", | |
7767 | SHOW_STR | |
7768 | BGP_STR | |
7769 | "BGP view\n" | |
7770 | "View name\n" | |
7771 | "Address family\n" | |
7772 | "Information about Route Server Clients\n" | |
7773 | "Summary of all Route Server Clients\n") | |
7774 | #endif /* HAVE IPV6 */ | |
7775 | \f | |
718e3744 | 7776 | /* Redistribute VTY commands. */ |
7777 | ||
7778 | /* Utility function to convert user input route type string to route | |
7779 | type. */ | |
7780 | static int | |
fd79ac91 | 7781 | bgp_str2route_type (int afi, const char *str) |
718e3744 | 7782 | { |
7783 | if (! str) | |
7784 | return 0; | |
7785 | ||
7786 | if (afi == AFI_IP) | |
7787 | { | |
7788 | if (strncmp (str, "k", 1) == 0) | |
7789 | return ZEBRA_ROUTE_KERNEL; | |
7790 | else if (strncmp (str, "c", 1) == 0) | |
7791 | return ZEBRA_ROUTE_CONNECT; | |
7792 | else if (strncmp (str, "s", 1) == 0) | |
7793 | return ZEBRA_ROUTE_STATIC; | |
7794 | else if (strncmp (str, "r", 1) == 0) | |
7795 | return ZEBRA_ROUTE_RIP; | |
7796 | else if (strncmp (str, "o", 1) == 0) | |
7797 | return ZEBRA_ROUTE_OSPF; | |
7798 | } | |
7799 | if (afi == AFI_IP6) | |
7800 | { | |
7801 | if (strncmp (str, "k", 1) == 0) | |
7802 | return ZEBRA_ROUTE_KERNEL; | |
7803 | else if (strncmp (str, "c", 1) == 0) | |
7804 | return ZEBRA_ROUTE_CONNECT; | |
7805 | else if (strncmp (str, "s", 1) == 0) | |
7806 | return ZEBRA_ROUTE_STATIC; | |
7807 | else if (strncmp (str, "r", 1) == 0) | |
7808 | return ZEBRA_ROUTE_RIPNG; | |
7809 | else if (strncmp (str, "o", 1) == 0) | |
7810 | return ZEBRA_ROUTE_OSPF6; | |
7811 | } | |
7812 | return 0; | |
7813 | } | |
7814 | ||
7815 | DEFUN (bgp_redistribute_ipv4, | |
7816 | bgp_redistribute_ipv4_cmd, | |
7817 | "redistribute (connected|kernel|ospf|rip|static)", | |
7818 | "Redistribute information from another routing protocol\n" | |
7819 | "Connected\n" | |
7820 | "Kernel routes\n" | |
7821 | "Open Shurtest Path First (OSPF)\n" | |
7822 | "Routing Information Protocol (RIP)\n" | |
7823 | "Static routes\n") | |
7824 | { | |
7825 | int type; | |
7826 | ||
7827 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
7828 | if (! type) | |
7829 | { | |
7830 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
7831 | return CMD_WARNING; | |
7832 | } | |
7833 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
7834 | } | |
7835 | ||
7836 | DEFUN (bgp_redistribute_ipv4_rmap, | |
7837 | bgp_redistribute_ipv4_rmap_cmd, | |
7838 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD", | |
7839 | "Redistribute information from another routing protocol\n" | |
7840 | "Connected\n" | |
7841 | "Kernel routes\n" | |
7842 | "Open Shurtest Path First (OSPF)\n" | |
7843 | "Routing Information Protocol (RIP)\n" | |
7844 | "Static routes\n" | |
7845 | "Route map reference\n" | |
7846 | "Pointer to route-map entries\n") | |
7847 | { | |
7848 | int type; | |
7849 | ||
7850 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
7851 | if (! type) | |
7852 | { | |
7853 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
7854 | return CMD_WARNING; | |
7855 | } | |
7856 | ||
7857 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
7858 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
7859 | } | |
7860 | ||
7861 | DEFUN (bgp_redistribute_ipv4_metric, | |
7862 | bgp_redistribute_ipv4_metric_cmd, | |
7863 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", | |
7864 | "Redistribute information from another routing protocol\n" | |
7865 | "Connected\n" | |
7866 | "Kernel routes\n" | |
7867 | "Open Shurtest Path First (OSPF)\n" | |
7868 | "Routing Information Protocol (RIP)\n" | |
7869 | "Static routes\n" | |
7870 | "Metric for redistributed routes\n" | |
7871 | "Default metric\n") | |
7872 | { | |
7873 | int type; | |
7874 | u_int32_t metric; | |
7875 | ||
7876 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
7877 | if (! type) | |
7878 | { | |
7879 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
7880 | return CMD_WARNING; | |
7881 | } | |
7882 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
7883 | ||
7884 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
7885 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
7886 | } | |
7887 | ||
7888 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
7889 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
7890 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", | |
7891 | "Redistribute information from another routing protocol\n" | |
7892 | "Connected\n" | |
7893 | "Kernel routes\n" | |
7894 | "Open Shurtest Path First (OSPF)\n" | |
7895 | "Routing Information Protocol (RIP)\n" | |
7896 | "Static routes\n" | |
7897 | "Route map reference\n" | |
7898 | "Pointer to route-map entries\n" | |
7899 | "Metric for redistributed routes\n" | |
7900 | "Default metric\n") | |
7901 | { | |
7902 | int type; | |
7903 | u_int32_t metric; | |
7904 | ||
7905 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
7906 | if (! type) | |
7907 | { | |
7908 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
7909 | return CMD_WARNING; | |
7910 | } | |
7911 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
7912 | ||
7913 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
7914 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
7915 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
7916 | } | |
7917 | ||
7918 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
7919 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
7920 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", | |
7921 | "Redistribute information from another routing protocol\n" | |
7922 | "Connected\n" | |
7923 | "Kernel routes\n" | |
7924 | "Open Shurtest Path First (OSPF)\n" | |
7925 | "Routing Information Protocol (RIP)\n" | |
7926 | "Static routes\n" | |
7927 | "Metric for redistributed routes\n" | |
7928 | "Default metric\n" | |
7929 | "Route map reference\n" | |
7930 | "Pointer to route-map entries\n") | |
7931 | { | |
7932 | int type; | |
7933 | u_int32_t metric; | |
7934 | ||
7935 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
7936 | if (! type) | |
7937 | { | |
7938 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
7939 | return CMD_WARNING; | |
7940 | } | |
7941 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
7942 | ||
7943 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
7944 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); | |
7945 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
7946 | } | |
7947 | ||
7948 | DEFUN (no_bgp_redistribute_ipv4, | |
7949 | no_bgp_redistribute_ipv4_cmd, | |
7950 | "no redistribute (connected|kernel|ospf|rip|static)", | |
7951 | NO_STR | |
7952 | "Redistribute information from another routing protocol\n" | |
7953 | "Connected\n" | |
7954 | "Kernel routes\n" | |
7955 | "Open Shurtest Path First (OSPF)\n" | |
7956 | "Routing Information Protocol (RIP)\n" | |
7957 | "Static routes\n") | |
7958 | { | |
7959 | int type; | |
7960 | ||
7961 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
7962 | if (! type) | |
7963 | { | |
7964 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
7965 | return CMD_WARNING; | |
7966 | } | |
7967 | ||
7968 | return bgp_redistribute_unset (vty->index, AFI_IP, type); | |
7969 | } | |
7970 | ||
7971 | DEFUN (no_bgp_redistribute_ipv4_rmap, | |
7972 | no_bgp_redistribute_ipv4_rmap_cmd, | |
7973 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", | |
7974 | NO_STR | |
7975 | "Redistribute information from another routing protocol\n" | |
7976 | "Connected\n" | |
7977 | "Kernel routes\n" | |
7978 | "Open Shurtest Path First (OSPF)\n" | |
7979 | "Routing Information Protocol (RIP)\n" | |
7980 | "Static routes\n" | |
7981 | "Route map reference\n" | |
7982 | "Pointer to route-map entries\n") | |
7983 | { | |
7984 | int type; | |
7985 | ||
7986 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
7987 | if (! type) | |
7988 | { | |
7989 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
7990 | return CMD_WARNING; | |
7991 | } | |
7992 | ||
7993 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
7994 | return CMD_SUCCESS; | |
7995 | } | |
7996 | ||
7997 | DEFUN (no_bgp_redistribute_ipv4_metric, | |
7998 | no_bgp_redistribute_ipv4_metric_cmd, | |
7999 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", | |
8000 | NO_STR | |
8001 | "Redistribute information from another routing protocol\n" | |
8002 | "Connected\n" | |
8003 | "Kernel routes\n" | |
8004 | "Open Shurtest Path First (OSPF)\n" | |
8005 | "Routing Information Protocol (RIP)\n" | |
8006 | "Static routes\n" | |
8007 | "Metric for redistributed routes\n" | |
8008 | "Default metric\n") | |
8009 | { | |
8010 | int type; | |
8011 | ||
8012 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8013 | if (! type) | |
8014 | { | |
8015 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8016 | return CMD_WARNING; | |
8017 | } | |
8018 | ||
8019 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
8020 | return CMD_SUCCESS; | |
8021 | } | |
8022 | ||
8023 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, | |
8024 | no_bgp_redistribute_ipv4_rmap_metric_cmd, | |
8025 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", | |
8026 | NO_STR | |
8027 | "Redistribute information from another routing protocol\n" | |
8028 | "Connected\n" | |
8029 | "Kernel routes\n" | |
8030 | "Open Shurtest Path First (OSPF)\n" | |
8031 | "Routing Information Protocol (RIP)\n" | |
8032 | "Static routes\n" | |
8033 | "Route map reference\n" | |
8034 | "Pointer to route-map entries\n" | |
8035 | "Metric for redistributed routes\n" | |
8036 | "Default metric\n") | |
8037 | { | |
8038 | int type; | |
8039 | ||
8040 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8041 | if (! type) | |
8042 | { | |
8043 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8044 | return CMD_WARNING; | |
8045 | } | |
8046 | ||
8047 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
8048 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
8049 | return CMD_SUCCESS; | |
8050 | } | |
8051 | ||
8052 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, | |
8053 | no_bgp_redistribute_ipv4_metric_rmap_cmd, | |
8054 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", | |
8055 | NO_STR | |
8056 | "Redistribute information from another routing protocol\n" | |
8057 | "Connected\n" | |
8058 | "Kernel routes\n" | |
8059 | "Open Shurtest Path First (OSPF)\n" | |
8060 | "Routing Information Protocol (RIP)\n" | |
8061 | "Static routes\n" | |
8062 | "Metric for redistributed routes\n" | |
8063 | "Default metric\n" | |
8064 | "Route map reference\n" | |
8065 | "Pointer to route-map entries\n") | |
8066 | \f | |
8067 | #ifdef HAVE_IPV6 | |
8068 | DEFUN (bgp_redistribute_ipv6, | |
8069 | bgp_redistribute_ipv6_cmd, | |
8070 | "redistribute (connected|kernel|ospf6|ripng|static)", | |
8071 | "Redistribute information from another routing protocol\n" | |
8072 | "Connected\n" | |
8073 | "Kernel routes\n" | |
8074 | "Open Shurtest Path First (OSPFv3)\n" | |
8075 | "Routing Information Protocol (RIPng)\n" | |
8076 | "Static routes\n") | |
8077 | { | |
8078 | int type; | |
8079 | ||
8080 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8081 | if (! type) | |
8082 | { | |
8083 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8084 | return CMD_WARNING; | |
8085 | } | |
8086 | ||
8087 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8088 | } | |
8089 | ||
8090 | DEFUN (bgp_redistribute_ipv6_rmap, | |
8091 | bgp_redistribute_ipv6_rmap_cmd, | |
8092 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", | |
8093 | "Redistribute information from another routing protocol\n" | |
8094 | "Connected\n" | |
8095 | "Kernel routes\n" | |
8096 | "Open Shurtest Path First (OSPFv3)\n" | |
8097 | "Routing Information Protocol (RIPng)\n" | |
8098 | "Static routes\n" | |
8099 | "Route map reference\n" | |
8100 | "Pointer to route-map entries\n") | |
8101 | { | |
8102 | int type; | |
8103 | ||
8104 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8105 | if (! type) | |
8106 | { | |
8107 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8108 | return CMD_WARNING; | |
8109 | } | |
8110 | ||
8111 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
8112 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8113 | } | |
8114 | ||
8115 | DEFUN (bgp_redistribute_ipv6_metric, | |
8116 | bgp_redistribute_ipv6_metric_cmd, | |
8117 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", | |
8118 | "Redistribute information from another routing protocol\n" | |
8119 | "Connected\n" | |
8120 | "Kernel routes\n" | |
8121 | "Open Shurtest Path First (OSPFv3)\n" | |
8122 | "Routing Information Protocol (RIPng)\n" | |
8123 | "Static routes\n" | |
8124 | "Metric for redistributed routes\n" | |
8125 | "Default metric\n") | |
8126 | { | |
8127 | int type; | |
8128 | u_int32_t metric; | |
8129 | ||
8130 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8131 | if (! type) | |
8132 | { | |
8133 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8134 | return CMD_WARNING; | |
8135 | } | |
8136 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8137 | ||
8138 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
8139 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8140 | } | |
8141 | ||
8142 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
8143 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
8144 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", | |
8145 | "Redistribute information from another routing protocol\n" | |
8146 | "Connected\n" | |
8147 | "Kernel routes\n" | |
8148 | "Open Shurtest Path First (OSPFv3)\n" | |
8149 | "Routing Information Protocol (RIPng)\n" | |
8150 | "Static routes\n" | |
8151 | "Route map reference\n" | |
8152 | "Pointer to route-map entries\n" | |
8153 | "Metric for redistributed routes\n" | |
8154 | "Default metric\n") | |
8155 | { | |
8156 | int type; | |
8157 | u_int32_t metric; | |
8158 | ||
8159 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8160 | if (! type) | |
8161 | { | |
8162 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8163 | return CMD_WARNING; | |
8164 | } | |
8165 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
8166 | ||
8167 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
8168 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
8169 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8170 | } | |
8171 | ||
8172 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
8173 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
8174 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", | |
8175 | "Redistribute information from another routing protocol\n" | |
8176 | "Connected\n" | |
8177 | "Kernel routes\n" | |
8178 | "Open Shurtest Path First (OSPFv3)\n" | |
8179 | "Routing Information Protocol (RIPng)\n" | |
8180 | "Static routes\n" | |
8181 | "Metric for redistributed routes\n" | |
8182 | "Default metric\n" | |
8183 | "Route map reference\n" | |
8184 | "Pointer to route-map entries\n") | |
8185 | { | |
8186 | int type; | |
8187 | u_int32_t metric; | |
8188 | ||
8189 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8190 | if (! type) | |
8191 | { | |
8192 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8193 | return CMD_WARNING; | |
8194 | } | |
8195 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8196 | ||
8197 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
8198 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); | |
8199 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8200 | } | |
8201 | ||
8202 | DEFUN (no_bgp_redistribute_ipv6, | |
8203 | no_bgp_redistribute_ipv6_cmd, | |
8204 | "no redistribute (connected|kernel|ospf6|ripng|static)", | |
8205 | NO_STR | |
8206 | "Redistribute information from another routing protocol\n" | |
8207 | "Connected\n" | |
8208 | "Kernel routes\n" | |
8209 | "Open Shurtest Path First (OSPFv3)\n" | |
8210 | "Routing Information Protocol (RIPng)\n" | |
8211 | "Static routes\n") | |
8212 | { | |
8213 | int type; | |
8214 | ||
8215 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8216 | if (! type) | |
8217 | { | |
8218 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8219 | return CMD_WARNING; | |
8220 | } | |
8221 | ||
8222 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); | |
8223 | } | |
8224 | ||
8225 | DEFUN (no_bgp_redistribute_ipv6_rmap, | |
8226 | no_bgp_redistribute_ipv6_rmap_cmd, | |
8227 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", | |
8228 | NO_STR | |
8229 | "Redistribute information from another routing protocol\n" | |
8230 | "Connected\n" | |
8231 | "Kernel routes\n" | |
8232 | "Open Shurtest Path First (OSPFv3)\n" | |
8233 | "Routing Information Protocol (RIPng)\n" | |
8234 | "Static routes\n" | |
8235 | "Route map reference\n" | |
8236 | "Pointer to route-map entries\n") | |
8237 | { | |
8238 | int type; | |
8239 | ||
8240 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8241 | if (! type) | |
8242 | { | |
8243 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8244 | return CMD_WARNING; | |
8245 | } | |
8246 | ||
8247 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
8248 | return CMD_SUCCESS; | |
8249 | } | |
8250 | ||
8251 | DEFUN (no_bgp_redistribute_ipv6_metric, | |
8252 | no_bgp_redistribute_ipv6_metric_cmd, | |
8253 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", | |
8254 | NO_STR | |
8255 | "Redistribute information from another routing protocol\n" | |
8256 | "Connected\n" | |
8257 | "Kernel routes\n" | |
8258 | "Open Shurtest Path First (OSPFv3)\n" | |
8259 | "Routing Information Protocol (RIPng)\n" | |
8260 | "Static routes\n" | |
8261 | "Metric for redistributed routes\n" | |
8262 | "Default metric\n") | |
8263 | { | |
8264 | int type; | |
8265 | ||
8266 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8267 | if (! type) | |
8268 | { | |
8269 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8270 | return CMD_WARNING; | |
8271 | } | |
8272 | ||
8273 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
8274 | return CMD_SUCCESS; | |
8275 | } | |
8276 | ||
8277 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, | |
8278 | no_bgp_redistribute_ipv6_rmap_metric_cmd, | |
8279 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", | |
8280 | NO_STR | |
8281 | "Redistribute information from another routing protocol\n" | |
8282 | "Connected\n" | |
8283 | "Kernel routes\n" | |
8284 | "Open Shurtest Path First (OSPFv3)\n" | |
8285 | "Routing Information Protocol (RIPng)\n" | |
8286 | "Static routes\n" | |
8287 | "Route map reference\n" | |
8288 | "Pointer to route-map entries\n" | |
8289 | "Metric for redistributed routes\n" | |
8290 | "Default metric\n") | |
8291 | { | |
8292 | int type; | |
8293 | ||
8294 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8295 | if (! type) | |
8296 | { | |
8297 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8298 | return CMD_WARNING; | |
8299 | } | |
8300 | ||
8301 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
8302 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
8303 | return CMD_SUCCESS; | |
8304 | } | |
8305 | ||
8306 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, | |
8307 | no_bgp_redistribute_ipv6_metric_rmap_cmd, | |
8308 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", | |
8309 | NO_STR | |
8310 | "Redistribute information from another routing protocol\n" | |
8311 | "Connected\n" | |
8312 | "Kernel routes\n" | |
8313 | "Open Shurtest Path First (OSPFv3)\n" | |
8314 | "Routing Information Protocol (RIPng)\n" | |
8315 | "Static routes\n" | |
8316 | "Metric for redistributed routes\n" | |
8317 | "Default metric\n" | |
8318 | "Route map reference\n" | |
8319 | "Pointer to route-map entries\n") | |
8320 | #endif /* HAVE_IPV6 */ | |
8321 | \f | |
8322 | int | |
8323 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
8324 | safi_t safi, int *write) | |
8325 | { | |
8326 | int i; | |
fd79ac91 | 8327 | const char *str[] = { "system", "kernel", "connected", "static", "rip", |
66e31693 | 8328 | "ripng", "ospf", "ospf6", "isis", "bgp"}; |
718e3744 | 8329 | |
8330 | /* Unicast redistribution only. */ | |
8331 | if (safi != SAFI_UNICAST) | |
8332 | return 0; | |
8333 | ||
8334 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
8335 | { | |
8336 | /* Redistribute BGP does not make sense. */ | |
8337 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) | |
8338 | { | |
8339 | /* Display "address-family" when it is not yet diplayed. */ | |
8340 | bgp_config_write_family_header (vty, afi, safi, write); | |
8341 | ||
8342 | /* "redistribute" configuration. */ | |
8343 | vty_out (vty, " redistribute %s", str[i]); | |
8344 | ||
8345 | if (bgp->redist_metric_flag[afi][i]) | |
8346 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); | |
8347 | ||
8348 | if (bgp->rmap[afi][i].name) | |
8349 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); | |
8350 | ||
8351 | vty_out (vty, "%s", VTY_NEWLINE); | |
8352 | } | |
8353 | } | |
8354 | return *write; | |
8355 | } | |
8356 | \f | |
8357 | /* BGP node structure. */ | |
8358 | struct cmd_node bgp_node = | |
8359 | { | |
8360 | BGP_NODE, | |
8361 | "%s(config-router)# ", | |
8362 | 1, | |
8363 | }; | |
8364 | ||
8365 | struct cmd_node bgp_ipv4_unicast_node = | |
8366 | { | |
8367 | BGP_IPV4_NODE, | |
8368 | "%s(config-router-af)# ", | |
8369 | 1, | |
8370 | }; | |
8371 | ||
8372 | struct cmd_node bgp_ipv4_multicast_node = | |
8373 | { | |
8374 | BGP_IPV4M_NODE, | |
8375 | "%s(config-router-af)# ", | |
8376 | 1, | |
8377 | }; | |
8378 | ||
8379 | struct cmd_node bgp_ipv6_unicast_node = | |
8380 | { | |
8381 | BGP_IPV6_NODE, | |
8382 | "%s(config-router-af)# ", | |
8383 | 1, | |
8384 | }; | |
8385 | ||
8386 | struct cmd_node bgp_vpnv4_node = | |
8387 | { | |
8388 | BGP_VPNV4_NODE, | |
8389 | "%s(config-router-af)# ", | |
8390 | 1 | |
8391 | }; | |
8392 | \f | |
8393 | void | |
8394 | bgp_vty_init () | |
8395 | { | |
8396 | int bgp_config_write (struct vty *); | |
8397 | void community_list_vty (); | |
8398 | ||
8399 | /* Install bgp top node. */ | |
8400 | install_node (&bgp_node, bgp_config_write); | |
8401 | install_node (&bgp_ipv4_unicast_node, NULL); | |
8402 | install_node (&bgp_ipv4_multicast_node, NULL); | |
8403 | install_node (&bgp_ipv6_unicast_node, NULL); | |
8404 | install_node (&bgp_vpnv4_node, NULL); | |
8405 | ||
8406 | /* Install default VTY commands to new nodes. */ | |
8407 | install_default (BGP_NODE); | |
8408 | install_default (BGP_IPV4_NODE); | |
8409 | install_default (BGP_IPV4M_NODE); | |
8410 | install_default (BGP_IPV6_NODE); | |
8411 | install_default (BGP_VPNV4_NODE); | |
8412 | ||
8413 | /* "bgp multiple-instance" commands. */ | |
8414 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
8415 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
8416 | ||
8417 | /* "bgp config-type" commands. */ | |
8418 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
8419 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
8420 | ||
8421 | /* Dummy commands (Currently not supported) */ | |
8422 | install_element (BGP_NODE, &no_synchronization_cmd); | |
8423 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
8424 | ||
8425 | /* "router bgp" commands. */ | |
8426 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
8427 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
8428 | ||
8429 | /* "no router bgp" commands. */ | |
8430 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
8431 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
8432 | ||
8433 | /* "bgp router-id" commands. */ | |
8434 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
8435 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
8436 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
8437 | ||
8438 | /* "bgp cluster-id" commands. */ | |
8439 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
8440 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
8441 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
8442 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
8443 | ||
8444 | /* "bgp confederation" commands. */ | |
8445 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
8446 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
8447 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
8448 | ||
8449 | /* "bgp confederation peers" commands. */ | |
8450 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
8451 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
8452 | ||
8453 | /* "timers bgp" commands. */ | |
8454 | install_element (BGP_NODE, &bgp_timers_cmd); | |
8455 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
8456 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
8457 | ||
8458 | /* "bgp client-to-client reflection" commands */ | |
8459 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
8460 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
8461 | ||
8462 | /* "bgp always-compare-med" commands */ | |
8463 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
8464 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
8465 | ||
8466 | /* "bgp deterministic-med" commands */ | |
8467 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
8468 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 8469 | |
8470 | #if 0 | |
8471 | /* "bgp graceful-restart" commands */ | |
8472 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
8473 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
8474 | #endif /* 0 */ | |
718e3744 | 8475 | |
8476 | /* "bgp fast-external-failover" commands */ | |
8477 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
8478 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
8479 | ||
8480 | /* "bgp enforce-first-as" commands */ | |
8481 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
8482 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
8483 | ||
8484 | /* "bgp bestpath compare-routerid" commands */ | |
8485 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
8486 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
8487 | ||
8488 | /* "bgp bestpath as-path ignore" commands */ | |
8489 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
8490 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
8491 | ||
848973c7 | 8492 | /* "bgp log-neighbor-changes" commands */ |
8493 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
8494 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
8495 | ||
718e3744 | 8496 | /* "bgp bestpath med" commands */ |
8497 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
8498 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
8499 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
8500 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
8501 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
8502 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
8503 | ||
8504 | /* "no bgp default ipv4-unicast" commands. */ | |
8505 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
8506 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
8507 | ||
8508 | /* "bgp network import-check" commands. */ | |
8509 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
8510 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
8511 | ||
8512 | /* "bgp default local-preference" commands. */ | |
8513 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
8514 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
8515 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
8516 | ||
8517 | /* "neighbor remote-as" commands. */ | |
8518 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
8519 | install_element (BGP_NODE, &no_neighbor_cmd); | |
8520 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
8521 | ||
8522 | /* "neighbor peer-group" commands. */ | |
8523 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
8524 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
8525 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); | |
8526 | ||
8527 | /* "neighbor local-as" commands. */ | |
8528 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
8529 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
8530 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); | |
8531 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
8532 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
8533 | ||
8534 | /* "neighbor activate" commands. */ | |
8535 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
8536 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
8537 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
8538 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
8539 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); | |
8540 | ||
8541 | /* "no neighbor activate" commands. */ | |
8542 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
8543 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
8544 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
8545 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
8546 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); | |
8547 | ||
8548 | /* "neighbor peer-group set" commands. */ | |
8549 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
8550 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
8551 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
8552 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
a58545bb | 8553 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
8554 | ||
718e3744 | 8555 | /* "no neighbor peer-group unset" commands. */ |
8556 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
8557 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
8558 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
8559 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
a58545bb | 8560 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
8561 | ||
718e3744 | 8562 | /* "neighbor softreconfiguration inbound" commands.*/ |
8563 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
8564 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8565 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
8566 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8567 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
8568 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8569 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
8570 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 8571 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
8572 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 8573 | |
8574 | /* "neighbor attribute-unchanged" commands. */ | |
8575 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
8576 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
8577 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
8578 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
8579 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
8580 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
8581 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
8582 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
8583 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
8584 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
8585 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
8586 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
8587 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
8588 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
8589 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
8590 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8591 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
8592 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
8593 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
8594 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
8595 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
8596 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8597 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
8598 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
8599 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
8600 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
8601 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
8602 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
8603 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
8604 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
8605 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
8606 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
8607 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
8608 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
8609 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
8610 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
8611 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
8612 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8613 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
8614 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
8615 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
8616 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
8617 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
8618 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8619 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
8620 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
8621 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
8622 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
8623 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
8624 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
8625 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
8626 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
8627 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
8628 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
8629 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
8630 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
8631 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
8632 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
8633 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
8634 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8635 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
8636 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
8637 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
8638 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
8639 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
8640 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8641 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
8642 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
8643 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
8644 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
8645 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
8646 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
8647 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
8648 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
8649 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
8650 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
8651 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
8652 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
8653 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
8654 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
8655 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
8656 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8657 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
8658 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
8659 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
8660 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
8661 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
8662 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8663 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); | |
8664 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
8665 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
8666 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
8667 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
8668 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
8669 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
8670 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
8671 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
8672 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
8673 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
8674 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
8675 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
8676 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
8677 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
8678 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8679 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
8680 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
8681 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
8682 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
8683 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
8684 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8685 | ||
fee0f4c6 | 8686 | /* "nexthop-local unchanged" commands */ |
8687 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
8688 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
8689 | ||
718e3744 | 8690 | /* "transparent-as" and "transparent-nexthop" for old version |
8691 | compatibility. */ | |
8692 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
8693 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
8694 | ||
8695 | /* "neighbor next-hop-self" commands. */ | |
8696 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
8697 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
8698 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
8699 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
8700 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
8701 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
8702 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
8703 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
8704 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); | |
8705 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
8706 | ||
8707 | /* "neighbor remove-private-AS" commands. */ | |
8708 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
8709 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
8710 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); | |
8711 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
8712 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); | |
8713 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
8714 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); | |
8715 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
8716 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); | |
8717 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
8718 | ||
8719 | /* "neighbor send-community" commands.*/ | |
8720 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
8721 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
8722 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
8723 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
8724 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
8725 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
8726 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
8727 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
8728 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
8729 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
8730 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
8731 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
8732 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
8733 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
8734 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
8735 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
8736 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); | |
8737 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
8738 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
8739 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
8740 | ||
8741 | /* "neighbor route-reflector" commands.*/ | |
8742 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
8743 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
8744 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
8745 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
8746 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
8747 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
8748 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
8749 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
8750 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); | |
8751 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
8752 | ||
8753 | /* "neighbor route-server" commands.*/ | |
8754 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
8755 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
8756 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
8757 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
8758 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
8759 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
8760 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
8761 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
8762 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); | |
8763 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
8764 | ||
8765 | /* "neighbor passive" commands. */ | |
8766 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
8767 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
8768 | ||
8769 | /* "neighbor shutdown" commands. */ | |
8770 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
8771 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
8772 | ||
8773 | /* "neighbor capability route-refresh" commands.*/ | |
8774 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); | |
8775 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
8776 | ||
8777 | /* "neighbor capability orf prefix-list" commands.*/ | |
8778 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
8779 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
8780 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
8781 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
8782 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
8783 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
8784 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
8785 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
8786 | ||
8787 | /* "neighbor capability dynamic" commands.*/ | |
8788 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
8789 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
8790 | ||
8791 | /* "neighbor dont-capability-negotiate" commands. */ | |
8792 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
8793 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
8794 | ||
8795 | /* "neighbor ebgp-multihop" commands. */ | |
8796 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
8797 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
8798 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
8799 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
8800 | ||
8801 | /* "neighbor enforce-multihop" commands. */ | |
8802 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); | |
8803 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
8804 | ||
8805 | /* "neighbor description" commands. */ | |
8806 | install_element (BGP_NODE, &neighbor_description_cmd); | |
8807 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
8808 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
8809 | ||
8810 | /* "neighbor update-source" commands. "*/ | |
8811 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
8812 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
8813 | ||
8814 | /* "neighbor default-originate" commands. */ | |
8815 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
8816 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
8817 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
8818 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
8819 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
8820 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
8821 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
8822 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
8823 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
8824 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
8825 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
8826 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
8827 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
8828 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
8829 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
8830 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
8831 | ||
8832 | /* "neighbor port" commands. */ | |
8833 | install_element (BGP_NODE, &neighbor_port_cmd); | |
8834 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
8835 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
8836 | ||
8837 | /* "neighbor weight" commands. */ | |
8838 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
8839 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
8840 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
8841 | ||
8842 | /* "neighbor override-capability" commands. */ | |
8843 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
8844 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
8845 | ||
8846 | /* "neighbor strict-capability-match" commands. */ | |
8847 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
8848 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
8849 | ||
8850 | /* "neighbor timers" commands. */ | |
8851 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
8852 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
8853 | ||
8854 | /* "neighbor timers connect" commands. */ | |
8855 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
8856 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
8857 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
8858 | ||
8859 | /* "neighbor advertisement-interval" commands. */ | |
8860 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
8861 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
8862 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
8863 | ||
8864 | /* "neighbor version" commands. */ | |
8865 | install_element (BGP_NODE, &neighbor_version_cmd); | |
8866 | install_element (BGP_NODE, &no_neighbor_version_cmd); | |
8867 | ||
8868 | /* "neighbor interface" commands. */ | |
8869 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
8870 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
8871 | ||
8872 | /* "neighbor distribute" commands. */ | |
8873 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
8874 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
8875 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
8876 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
8877 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
8878 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
8879 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
8880 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
8881 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); | |
8882 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
8883 | ||
8884 | /* "neighbor prefix-list" commands. */ | |
8885 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
8886 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
8887 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
8888 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
8889 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
8890 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
8891 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
8892 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
8893 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); | |
8894 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
8895 | ||
8896 | /* "neighbor filter-list" commands. */ | |
8897 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
8898 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
8899 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
8900 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
8901 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
8902 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
8903 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
8904 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
8905 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); | |
8906 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
8907 | ||
8908 | /* "neighbor route-map" commands. */ | |
8909 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
8910 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
8911 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
8912 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
8913 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
8914 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
8915 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
8916 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
8917 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); | |
8918 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
8919 | ||
8920 | /* "neighbor unsuppress-map" commands. */ | |
8921 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
8922 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
8923 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
8924 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
8925 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
8926 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
8927 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
8928 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 8929 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
8930 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 8931 | |
8932 | /* "neighbor maximum-prefix" commands. */ | |
8933 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 8934 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 8935 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 8936 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
718e3744 | 8937 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
8938 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
8939 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val2_cmd); | |
e0701b79 | 8940 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val3_cmd); |
718e3744 | 8941 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 8942 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 8943 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 8944 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
718e3744 | 8945 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
8946 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
8947 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val2_cmd); | |
e0701b79 | 8948 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val3_cmd); |
718e3744 | 8949 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 8950 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 8951 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 8952 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
718e3744 | 8953 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
8954 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
8955 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val2_cmd); | |
e0701b79 | 8956 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val3_cmd); |
718e3744 | 8957 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 8958 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 8959 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 8960 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
718e3744 | 8961 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
8962 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
8963 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val2_cmd); | |
e0701b79 | 8964 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val3_cmd); |
718e3744 | 8965 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 8966 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 8967 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 8968 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
718e3744 | 8969 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
8970 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
8971 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val2_cmd); | |
e0701b79 | 8972 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val3_cmd); |
718e3744 | 8973 | |
8974 | /* "neighbor allowas-in" */ | |
8975 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
8976 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
8977 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
8978 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
8979 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
8980 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
8981 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
8982 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
8983 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
8984 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
8985 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
8986 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
8987 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); | |
8988 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
8989 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
8990 | ||
8991 | /* address-family commands. */ | |
8992 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
8993 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
8994 | #ifdef HAVE_IPV6 | |
8995 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
8996 | install_element (BGP_NODE, &address_family_ipv6_unicast_cmd); | |
8997 | #endif /* HAVE_IPV6 */ | |
8998 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
8999 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
9000 | ||
9001 | /* "exit-address-family" command. */ | |
9002 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
9003 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
9004 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
9005 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); | |
9006 | ||
9007 | /* "clear ip bgp commands" */ | |
9008 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
9009 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
9010 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
9011 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
9012 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
9013 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
9014 | #ifdef HAVE_IPV6 | |
9015 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
9016 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
9017 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
9018 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
9019 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
9020 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
9021 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
9022 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
9023 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
9024 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
9025 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
9026 | #endif /* HAVE_IPV6 */ | |
9027 | ||
9028 | /* "clear ip bgp neighbor soft in" */ | |
9029 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
9030 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
9031 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
9032 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
9033 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
9034 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
9035 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
9036 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
9037 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
9038 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
9039 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
9040 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
9041 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
9042 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
9043 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
9044 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
9045 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
9046 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
9047 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
9048 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
9049 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
9050 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
9051 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
9052 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
9053 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
9054 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
9055 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
9056 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
9057 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
9058 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
9059 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
9060 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
9061 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
9062 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
9063 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
9064 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
9065 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
9066 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
9067 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
9068 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
9069 | #ifdef HAVE_IPV6 | |
9070 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
9071 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
9072 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
9073 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
9074 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
9075 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
9076 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
9077 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
9078 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
9079 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
9080 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
9081 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
9082 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
9083 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
9084 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
9085 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
9086 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
9087 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
9088 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
9089 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
9090 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
9091 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
9092 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
9093 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
9094 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
9095 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
9096 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
9097 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
9098 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
9099 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
9100 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
9101 | #endif /* HAVE_IPV6 */ | |
9102 | ||
9103 | /* "clear ip bgp neighbor soft out" */ | |
9104 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
9105 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
9106 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
9107 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
9108 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
9109 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
9110 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
9111 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
9112 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
9113 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
9114 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
9115 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
9116 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
9117 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
9118 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
9119 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
9120 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
9121 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
9122 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
9123 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
9124 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
9125 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
9126 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
9127 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
9128 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
9129 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
9130 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
9131 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
9132 | #ifdef HAVE_IPV6 | |
9133 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
9134 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
9135 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
9136 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
9137 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
9138 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
9139 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
9140 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
9141 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
9142 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
9143 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
9144 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
9145 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
9146 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
9147 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
9148 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
9149 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
9150 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
9151 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
9152 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
9153 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
9154 | #endif /* HAVE_IPV6 */ | |
9155 | ||
9156 | /* "clear ip bgp neighbor soft" */ | |
9157 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
9158 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
9159 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
9160 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
9161 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
9162 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
9163 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
9164 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
9165 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
9166 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
9167 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
9168 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
9169 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
9170 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
9171 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
9172 | #ifdef HAVE_IPV6 | |
9173 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
9174 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
9175 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
9176 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
9177 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
9178 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
9179 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
9180 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
9181 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
9182 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
9183 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
9184 | #endif /* HAVE_IPV6 */ | |
9185 | ||
fee0f4c6 | 9186 | /* "clear ip bgp neighbor rsclient" */ |
9187 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
9188 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
9189 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
9190 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
9191 | #ifdef HAVE_IPV6 | |
9192 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
9193 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
9194 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
9195 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
9196 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
9197 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
9198 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
9199 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
9200 | #endif /* HAVE_IPV6 */ | |
9201 | ||
718e3744 | 9202 | /* "show ip bgp summary" commands. */ |
9203 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
9204 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); | |
9205 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
9206 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
9207 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
9208 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
9209 | #ifdef HAVE_IPV6 | |
9210 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
9211 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
9212 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
9213 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); | |
9214 | #endif /* HAVE_IPV6 */ | |
9215 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
9216 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); | |
9217 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
9218 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
9219 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
9220 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
9221 | #ifdef HAVE_IPV6 | |
9222 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
9223 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
9224 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
9225 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); | |
9226 | #endif /* HAVE_IPV6 */ | |
9227 | ||
9228 | /* "show ip bgp neighbors" commands. */ | |
9229 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
9230 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
9231 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
9232 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
9233 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
9234 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
9235 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
9236 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
9237 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
9238 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
9239 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); | |
9240 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
9241 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
9242 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
9243 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
9244 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
9245 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
9246 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
9247 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
9248 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
9249 | ||
9250 | #ifdef HAVE_IPV6 | |
9251 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
9252 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
9253 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
9254 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 9255 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
9256 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
9257 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
9258 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 9259 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
9260 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
9261 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
9262 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 9263 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
9264 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
9265 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
9266 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 9267 | |
9268 | /* Old commands. */ | |
9269 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
9270 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
9271 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
9272 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
9273 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 9274 | |
9275 | /* "show ip bgp rsclient" commands. */ | |
9276 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
9277 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
9278 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
9279 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
9280 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
9281 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
9282 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
9283 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
9284 | ||
9285 | #ifdef HAVE_IPV6 | |
9286 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
9287 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
9288 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
9289 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
9290 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); | |
9291 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
9292 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
9293 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
9294 | #endif /* HAVE_IPV6 */ | |
718e3744 | 9295 | |
9296 | /* "show ip bgp paths" commands. */ | |
9297 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
9298 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
9299 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
9300 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
9301 | ||
9302 | /* "show ip bgp community" commands. */ | |
9303 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
9304 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
9305 | ||
9306 | /* "show ip bgp attribute-info" commands. */ | |
9307 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
9308 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
9309 | ||
9310 | /* "redistribute" commands. */ | |
9311 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
9312 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
9313 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
9314 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
9315 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
9316 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
9317 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
9318 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
9319 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
9320 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
9321 | #ifdef HAVE_IPV6 | |
9322 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
9323 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
9324 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
9325 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
9326 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
9327 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
9328 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
9329 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
9330 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
9331 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
9332 | #endif /* HAVE_IPV6 */ | |
9333 | ||
9334 | /* Community-list. */ | |
9335 | community_list_vty (); | |
9336 | } | |
9337 | \f | |
9338 | #include "memory.h" | |
9339 | #include "bgp_regex.h" | |
9340 | #include "bgp_clist.h" | |
9341 | #include "bgp_ecommunity.h" | |
9342 | ||
9343 | /* VTY functions. */ | |
9344 | ||
9345 | /* Direction value to string conversion. */ | |
fd79ac91 | 9346 | const char * |
718e3744 | 9347 | community_direct_str (int direct) |
9348 | { | |
9349 | switch (direct) | |
9350 | { | |
9351 | case COMMUNITY_DENY: | |
9352 | return "deny"; | |
9353 | break; | |
9354 | case COMMUNITY_PERMIT: | |
9355 | return "permit"; | |
9356 | break; | |
9357 | default: | |
9358 | return "unknown"; | |
9359 | break; | |
9360 | } | |
9361 | } | |
9362 | ||
9363 | /* Display error string. */ | |
9364 | void | |
9365 | community_list_perror (struct vty *vty, int ret) | |
9366 | { | |
9367 | switch (ret) | |
9368 | { | |
9369 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
9370 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); | |
9371 | break; | |
9372 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
9373 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
9374 | break; | |
9375 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
9376 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
9377 | break; | |
9378 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
9379 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
9380 | break; | |
9381 | } | |
9382 | } | |
9383 | ||
9384 | /* VTY interface for community_set() function. */ | |
9385 | int | |
fd79ac91 | 9386 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
9387 | int style, int reject_all_digit_name) | |
718e3744 | 9388 | { |
9389 | int ret; | |
9390 | int direct; | |
9391 | char *str; | |
9392 | ||
9393 | /* Check the list type. */ | |
9394 | if (strncmp (argv[1], "p", 1) == 0) | |
9395 | direct = COMMUNITY_PERMIT; | |
9396 | else if (strncmp (argv[1], "d", 1) == 0) | |
9397 | direct = COMMUNITY_DENY; | |
9398 | else | |
9399 | { | |
9400 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
9401 | VTY_NEWLINE); | |
9402 | return CMD_WARNING; | |
9403 | } | |
9404 | ||
9405 | /* All digit name check. */ | |
9406 | if (reject_all_digit_name && all_digit (argv[0])) | |
9407 | { | |
9408 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
9409 | return CMD_WARNING; | |
9410 | } | |
9411 | ||
9412 | /* Concat community string argument. */ | |
9413 | if (argc > 1) | |
9414 | str = argv_concat (argv, argc, 2); | |
9415 | else | |
9416 | str = NULL; | |
9417 | ||
9418 | /* When community_list_set() return nevetive value, it means | |
9419 | malformed community string. */ | |
9420 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
9421 | ||
9422 | /* Free temporary community list string allocated by | |
9423 | argv_concat(). */ | |
9424 | if (str) | |
9425 | XFREE (MTYPE_TMP, str); | |
9426 | ||
9427 | if (ret < 0) | |
9428 | { | |
9429 | /* Display error string. */ | |
9430 | community_list_perror (vty, ret); | |
9431 | return CMD_WARNING; | |
9432 | } | |
9433 | ||
9434 | return CMD_SUCCESS; | |
9435 | } | |
9436 | ||
9437 | /* Community-list delete with name. */ | |
9438 | int | |
fd79ac91 | 9439 | community_list_unset_all_vty (struct vty *vty, const char *name) |
718e3744 | 9440 | { |
9441 | int ret; | |
9442 | ||
9443 | ret = community_list_unset (bgp_clist, name, NULL, 0, COMMUNITY_LIST_AUTO); | |
9444 | ||
9445 | if (ret < 0) | |
9446 | { | |
9447 | community_list_perror (vty, ret); | |
9448 | return CMD_WARNING; | |
9449 | } | |
9450 | return CMD_SUCCESS; | |
9451 | } | |
9452 | ||
9453 | /* Communiyt-list entry delete. */ | |
9454 | int | |
fd79ac91 | 9455 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
9456 | int style) | |
718e3744 | 9457 | { |
9458 | int ret; | |
9459 | int direct; | |
9460 | char *str; | |
9461 | ||
9462 | /* Check the list direct. */ | |
9463 | if (strncmp (argv[1], "p", 1) == 0) | |
9464 | direct = COMMUNITY_PERMIT; | |
9465 | else if (strncmp (argv[1], "d", 1) == 0) | |
9466 | direct = COMMUNITY_DENY; | |
9467 | else | |
9468 | { | |
9469 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
9470 | VTY_NEWLINE); | |
9471 | return CMD_WARNING; | |
9472 | } | |
9473 | ||
9474 | /* Concat community string argument. */ | |
9475 | str = argv_concat (argv, argc, 2); | |
9476 | ||
9477 | /* Unset community list. */ | |
9478 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
9479 | ||
9480 | /* Free temporary community list string allocated by | |
9481 | argv_concat(). */ | |
9482 | XFREE (MTYPE_TMP, str); | |
9483 | ||
9484 | if (ret < 0) | |
9485 | { | |
9486 | community_list_perror (vty, ret); | |
9487 | return CMD_WARNING; | |
9488 | } | |
9489 | ||
9490 | return CMD_SUCCESS; | |
9491 | } | |
9492 | ||
9493 | /* "community-list" keyword help string. */ | |
9494 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
9495 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
9496 | ||
9497 | DEFUN (ip_community_list, | |
9498 | ip_community_list_cmd, | |
9499 | "ip community-list WORD (deny|permit) .AA:NN", | |
9500 | IP_STR | |
9501 | COMMUNITY_LIST_STR | |
9502 | "Community list name\n" | |
9503 | "Specify community to reject\n" | |
9504 | "Specify community to accept\n" | |
9505 | COMMUNITY_VAL_STR) | |
9506 | { | |
9507 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_AUTO, 1); | |
9508 | } | |
9509 | ||
9510 | DEFUN (ip_community_list_standard, | |
9511 | ip_community_list_standard_cmd, | |
9512 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
9513 | IP_STR | |
9514 | COMMUNITY_LIST_STR | |
9515 | "Community list number (standard)\n" | |
9516 | "Specify community to reject\n" | |
9517 | "Specify community to accept\n" | |
9518 | COMMUNITY_VAL_STR) | |
9519 | { | |
9520 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
9521 | } | |
9522 | ||
9523 | ALIAS (ip_community_list_standard, | |
9524 | ip_community_list_standard2_cmd, | |
9525 | "ip community-list <1-99> (deny|permit)", | |
9526 | IP_STR | |
9527 | COMMUNITY_LIST_STR | |
9528 | "Community list number (standard)\n" | |
9529 | "Specify community to reject\n" | |
9530 | "Specify community to accept\n") | |
9531 | ||
9532 | DEFUN (ip_community_list_expanded, | |
9533 | ip_community_list_expanded_cmd, | |
9534 | "ip community-list <100-199> (deny|permit) .LINE", | |
9535 | IP_STR | |
9536 | COMMUNITY_LIST_STR | |
9537 | "Community list number (expanded)\n" | |
9538 | "Specify community to reject\n" | |
9539 | "Specify community to accept\n" | |
9540 | "An ordered list as a regular-expression\n") | |
9541 | { | |
9542 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
9543 | } | |
9544 | ||
9545 | DEFUN (ip_community_list_name_standard, | |
9546 | ip_community_list_name_standard_cmd, | |
9547 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
9548 | IP_STR | |
9549 | COMMUNITY_LIST_STR | |
9550 | "Add a standard community-list entry\n" | |
9551 | "Community list name\n" | |
9552 | "Specify community to reject\n" | |
9553 | "Specify community to accept\n" | |
9554 | COMMUNITY_VAL_STR) | |
9555 | { | |
9556 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
9557 | } | |
9558 | ||
9559 | ALIAS (ip_community_list_name_standard, | |
9560 | ip_community_list_name_standard2_cmd, | |
9561 | "ip community-list standard WORD (deny|permit)", | |
9562 | IP_STR | |
9563 | COMMUNITY_LIST_STR | |
9564 | "Add a standard community-list entry\n" | |
9565 | "Community list name\n" | |
9566 | "Specify community to reject\n" | |
9567 | "Specify community to accept\n") | |
9568 | ||
9569 | DEFUN (ip_community_list_name_expanded, | |
9570 | ip_community_list_name_expanded_cmd, | |
9571 | "ip community-list expanded WORD (deny|permit) .LINE", | |
9572 | IP_STR | |
9573 | COMMUNITY_LIST_STR | |
9574 | "Add an expanded community-list entry\n" | |
9575 | "Community list name\n" | |
9576 | "Specify community to reject\n" | |
9577 | "Specify community to accept\n" | |
9578 | "An ordered list as a regular-expression\n") | |
9579 | { | |
9580 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
9581 | } | |
9582 | ||
9583 | DEFUN (no_ip_community_list_all, | |
9584 | no_ip_community_list_all_cmd, | |
9585 | "no ip community-list (WORD|<1-99>|<100-199>)", | |
9586 | NO_STR | |
9587 | IP_STR | |
9588 | COMMUNITY_LIST_STR | |
9589 | "Community list name\n" | |
9590 | "Community list number (standard)\n" | |
9591 | "Community list number (expanded)\n") | |
9592 | { | |
9593 | return community_list_unset_all_vty (vty, argv[0]); | |
9594 | } | |
9595 | ||
9596 | DEFUN (no_ip_community_list_name_all, | |
9597 | no_ip_community_list_name_all_cmd, | |
9598 | "no ip community-list (standard|expanded) WORD", | |
9599 | NO_STR | |
9600 | IP_STR | |
9601 | COMMUNITY_LIST_STR | |
9602 | "Add a standard community-list entry\n" | |
9603 | "Add an expanded community-list entry\n" | |
9604 | "Community list name\n") | |
9605 | { | |
9606 | return community_list_unset_all_vty (vty, argv[1]); | |
9607 | } | |
9608 | ||
9609 | DEFUN (no_ip_community_list, | |
9610 | no_ip_community_list_cmd, | |
9611 | "no ip community-list WORD (deny|permit) .AA:NN", | |
9612 | NO_STR | |
9613 | IP_STR | |
9614 | COMMUNITY_LIST_STR | |
9615 | "Community list name\n" | |
9616 | "Specify community to reject\n" | |
9617 | "Specify community to accept\n" | |
9618 | COMMUNITY_VAL_STR) | |
9619 | { | |
9620 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_AUTO); | |
9621 | } | |
9622 | ||
9623 | DEFUN (no_ip_community_list_standard, | |
9624 | no_ip_community_list_standard_cmd, | |
9625 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
9626 | NO_STR | |
9627 | IP_STR | |
9628 | COMMUNITY_LIST_STR | |
9629 | "Community list number (standard)\n" | |
9630 | "Specify community to reject\n" | |
9631 | "Specify community to accept\n" | |
9632 | COMMUNITY_VAL_STR) | |
9633 | { | |
9634 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
9635 | } | |
9636 | ||
9637 | DEFUN (no_ip_community_list_expanded, | |
9638 | no_ip_community_list_expanded_cmd, | |
9639 | "no ip community-list <100-199> (deny|permit) .LINE", | |
9640 | NO_STR | |
9641 | IP_STR | |
9642 | COMMUNITY_LIST_STR | |
9643 | "Community list number (expanded)\n" | |
9644 | "Specify community to reject\n" | |
9645 | "Specify community to accept\n" | |
9646 | "An ordered list as a regular-expression\n") | |
9647 | { | |
9648 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
9649 | } | |
9650 | ||
9651 | DEFUN (no_ip_community_list_name_standard, | |
9652 | no_ip_community_list_name_standard_cmd, | |
9653 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
9654 | NO_STR | |
9655 | IP_STR | |
9656 | COMMUNITY_LIST_STR | |
9657 | "Specify a standard community-list\n" | |
9658 | "Community list name\n" | |
9659 | "Specify community to reject\n" | |
9660 | "Specify community to accept\n" | |
9661 | COMMUNITY_VAL_STR) | |
9662 | { | |
9663 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
9664 | } | |
9665 | ||
9666 | DEFUN (no_ip_community_list_name_expanded, | |
9667 | no_ip_community_list_name_expanded_cmd, | |
9668 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
9669 | NO_STR | |
9670 | IP_STR | |
9671 | COMMUNITY_LIST_STR | |
9672 | "Specify an expanded community-list\n" | |
9673 | "Community list name\n" | |
9674 | "Specify community to reject\n" | |
9675 | "Specify community to accept\n" | |
9676 | "An ordered list as a regular-expression\n") | |
9677 | { | |
9678 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
9679 | } | |
9680 | ||
9681 | void | |
9682 | community_list_show (struct vty *vty, struct community_list *list) | |
9683 | { | |
9684 | struct community_entry *entry; | |
9685 | ||
9686 | for (entry = list->head; entry; entry = entry->next) | |
9687 | { | |
9688 | if (entry == list->head) | |
9689 | { | |
9690 | if (all_digit (list->name)) | |
9691 | vty_out (vty, "Community %s list %s%s", | |
9692 | entry->style == COMMUNITY_LIST_STANDARD ? | |
9693 | "standard" : "(expanded) access", | |
9694 | list->name, VTY_NEWLINE); | |
9695 | else | |
9696 | vty_out (vty, "Named Community %s list %s%s", | |
9697 | entry->style == COMMUNITY_LIST_STANDARD ? | |
9698 | "standard" : "expanded", | |
9699 | list->name, VTY_NEWLINE); | |
9700 | } | |
9701 | if (entry->any) | |
9702 | vty_out (vty, " %s%s", | |
9703 | community_direct_str (entry->direct), VTY_NEWLINE); | |
9704 | else | |
9705 | vty_out (vty, " %s %s%s", | |
9706 | community_direct_str (entry->direct), | |
9707 | entry->style == COMMUNITY_LIST_STANDARD | |
9708 | ? community_str (entry->u.com) : entry->config, | |
9709 | VTY_NEWLINE); | |
9710 | } | |
9711 | } | |
9712 | ||
9713 | DEFUN (show_ip_community_list, | |
9714 | show_ip_community_list_cmd, | |
9715 | "show ip community-list", | |
9716 | SHOW_STR | |
9717 | IP_STR | |
9718 | "List community-list\n") | |
9719 | { | |
9720 | struct community_list *list; | |
9721 | struct community_list_master *cm; | |
9722 | ||
9723 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_AUTO); | |
9724 | if (! cm) | |
9725 | return CMD_SUCCESS; | |
9726 | ||
9727 | for (list = cm->num.head; list; list = list->next) | |
9728 | community_list_show (vty, list); | |
9729 | ||
9730 | for (list = cm->str.head; list; list = list->next) | |
9731 | community_list_show (vty, list); | |
9732 | ||
9733 | return CMD_SUCCESS; | |
9734 | } | |
9735 | ||
9736 | DEFUN (show_ip_community_list_arg, | |
9737 | show_ip_community_list_arg_cmd, | |
9738 | "show ip community-list (<1-199>|WORD)", | |
9739 | SHOW_STR | |
9740 | IP_STR | |
9741 | "List community-list\n" | |
9742 | "Community-list number\n" | |
9743 | "Community-list name\n") | |
9744 | { | |
9745 | struct community_list *list; | |
9746 | ||
9747 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_AUTO); | |
9748 | if (! list) | |
9749 | { | |
9750 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); | |
9751 | return CMD_WARNING; | |
9752 | } | |
9753 | ||
9754 | community_list_show (vty, list); | |
9755 | ||
9756 | return CMD_SUCCESS; | |
9757 | } | |
9758 | \f | |
9759 | int | |
fd79ac91 | 9760 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
9761 | int style, int reject_all_digit_name) | |
718e3744 | 9762 | { |
9763 | int ret; | |
9764 | int direct; | |
9765 | char *str; | |
9766 | ||
9767 | /* Check the list type. */ | |
9768 | if (strncmp (argv[1], "p", 1) == 0) | |
9769 | direct = COMMUNITY_PERMIT; | |
9770 | else if (strncmp (argv[1], "d", 1) == 0) | |
9771 | direct = COMMUNITY_DENY; | |
9772 | else | |
9773 | { | |
9774 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
9775 | VTY_NEWLINE); | |
9776 | return CMD_WARNING; | |
9777 | } | |
9778 | ||
9779 | /* All digit name check. */ | |
9780 | if (reject_all_digit_name && all_digit (argv[0])) | |
9781 | { | |
9782 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
9783 | return CMD_WARNING; | |
9784 | } | |
9785 | ||
9786 | /* Concat community string argument. */ | |
9787 | if (argc > 1) | |
9788 | str = argv_concat (argv, argc, 2); | |
9789 | else | |
9790 | str = NULL; | |
9791 | ||
9792 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
9793 | ||
9794 | /* Free temporary community list string allocated by | |
9795 | argv_concat(). */ | |
9796 | if (str) | |
9797 | XFREE (MTYPE_TMP, str); | |
9798 | ||
9799 | if (ret < 0) | |
9800 | { | |
9801 | community_list_perror (vty, ret); | |
9802 | return CMD_WARNING; | |
9803 | } | |
9804 | return CMD_SUCCESS; | |
9805 | } | |
9806 | ||
9807 | int | |
fd79ac91 | 9808 | extcommunity_list_unset_all_vty (struct vty *vty, const char *name) |
718e3744 | 9809 | { |
9810 | int ret; | |
9811 | ||
9812 | ret = extcommunity_list_unset (bgp_clist, name, NULL, 0, EXTCOMMUNITY_LIST_AUTO); | |
9813 | ||
9814 | if (ret < 0) | |
9815 | { | |
9816 | community_list_perror (vty, ret); | |
9817 | return CMD_WARNING; | |
9818 | } | |
9819 | return CMD_SUCCESS; | |
9820 | } | |
9821 | ||
9822 | int | |
fd79ac91 | 9823 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
9824 | int style) | |
718e3744 | 9825 | { |
9826 | int ret; | |
9827 | int direct; | |
9828 | char *str; | |
9829 | ||
9830 | /* Check the list direct. */ | |
9831 | if (strncmp (argv[1], "p", 1) == 0) | |
9832 | direct = COMMUNITY_PERMIT; | |
9833 | else if (strncmp (argv[1], "d", 1) == 0) | |
9834 | direct = COMMUNITY_DENY; | |
9835 | else | |
9836 | { | |
9837 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
9838 | VTY_NEWLINE); | |
9839 | return CMD_WARNING; | |
9840 | } | |
9841 | ||
9842 | /* Concat community string argument. */ | |
9843 | str = argv_concat (argv, argc, 2); | |
9844 | ||
9845 | /* Unset community list. */ | |
9846 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
9847 | ||
9848 | /* Free temporary community list string allocated by | |
9849 | argv_concat(). */ | |
9850 | XFREE (MTYPE_TMP, str); | |
9851 | ||
9852 | if (ret < 0) | |
9853 | { | |
9854 | community_list_perror (vty, ret); | |
9855 | return CMD_WARNING; | |
9856 | } | |
9857 | ||
9858 | return CMD_SUCCESS; | |
9859 | } | |
9860 | ||
9861 | /* "extcommunity-list" keyword help string. */ | |
9862 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
9863 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
9864 | ||
9865 | DEFUN (ip_extcommunity_list_standard, | |
9866 | ip_extcommunity_list_standard_cmd, | |
9867 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
9868 | IP_STR | |
9869 | EXTCOMMUNITY_LIST_STR | |
9870 | "Extended Community list number (standard)\n" | |
9871 | "Specify community to reject\n" | |
9872 | "Specify community to accept\n" | |
9873 | EXTCOMMUNITY_VAL_STR) | |
9874 | { | |
9875 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
9876 | } | |
9877 | ||
9878 | ALIAS (ip_extcommunity_list_standard, | |
9879 | ip_extcommunity_list_standard2_cmd, | |
9880 | "ip extcommunity-list <1-99> (deny|permit)", | |
9881 | IP_STR | |
9882 | EXTCOMMUNITY_LIST_STR | |
9883 | "Extended Community list number (standard)\n" | |
9884 | "Specify community to reject\n" | |
9885 | "Specify community to accept\n") | |
9886 | ||
9887 | DEFUN (ip_extcommunity_list_expanded, | |
9888 | ip_extcommunity_list_expanded_cmd, | |
9889 | "ip extcommunity-list <100-199> (deny|permit) .LINE", | |
9890 | IP_STR | |
9891 | EXTCOMMUNITY_LIST_STR | |
9892 | "Extended Community list number (expanded)\n" | |
9893 | "Specify community to reject\n" | |
9894 | "Specify community to accept\n" | |
9895 | "An ordered list as a regular-expression\n") | |
9896 | { | |
9897 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
9898 | } | |
9899 | ||
9900 | DEFUN (ip_extcommunity_list_name_standard, | |
9901 | ip_extcommunity_list_name_standard_cmd, | |
9902 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
9903 | IP_STR | |
9904 | EXTCOMMUNITY_LIST_STR | |
9905 | "Specify standard extcommunity-list\n" | |
9906 | "Extended Community list name\n" | |
9907 | "Specify community to reject\n" | |
9908 | "Specify community to accept\n" | |
9909 | EXTCOMMUNITY_VAL_STR) | |
9910 | { | |
9911 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
9912 | } | |
9913 | ||
9914 | ALIAS (ip_extcommunity_list_name_standard, | |
9915 | ip_extcommunity_list_name_standard2_cmd, | |
9916 | "ip extcommunity-list standard WORD (deny|permit)", | |
9917 | IP_STR | |
9918 | EXTCOMMUNITY_LIST_STR | |
9919 | "Specify standard extcommunity-list\n" | |
9920 | "Extended Community list name\n" | |
9921 | "Specify community to reject\n" | |
9922 | "Specify community to accept\n") | |
9923 | ||
9924 | DEFUN (ip_extcommunity_list_name_expanded, | |
9925 | ip_extcommunity_list_name_expanded_cmd, | |
9926 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
9927 | IP_STR | |
9928 | EXTCOMMUNITY_LIST_STR | |
9929 | "Specify expanded extcommunity-list\n" | |
9930 | "Extended Community list name\n" | |
9931 | "Specify community to reject\n" | |
9932 | "Specify community to accept\n" | |
9933 | "An ordered list as a regular-expression\n") | |
9934 | { | |
9935 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
9936 | } | |
9937 | ||
9938 | DEFUN (no_ip_extcommunity_list_all, | |
9939 | no_ip_extcommunity_list_all_cmd, | |
9940 | "no ip extcommunity-list (<1-99>|<100-199>)", | |
9941 | NO_STR | |
9942 | IP_STR | |
9943 | EXTCOMMUNITY_LIST_STR | |
9944 | "Extended Community list number (standard)\n" | |
9945 | "Extended Community list number (expanded)\n") | |
9946 | { | |
9947 | return extcommunity_list_unset_all_vty (vty, argv[0]); | |
9948 | } | |
9949 | ||
9950 | DEFUN (no_ip_extcommunity_list_name_all, | |
9951 | no_ip_extcommunity_list_name_all_cmd, | |
9952 | "no ip extcommunity-list (standard|expanded) WORD", | |
9953 | NO_STR | |
9954 | IP_STR | |
9955 | EXTCOMMUNITY_LIST_STR | |
9956 | "Specify standard extcommunity-list\n" | |
9957 | "Specify expanded extcommunity-list\n" | |
9958 | "Extended Community list name\n") | |
9959 | { | |
9960 | return extcommunity_list_unset_all_vty (vty, argv[1]); | |
9961 | } | |
9962 | ||
9963 | DEFUN (no_ip_extcommunity_list_standard, | |
9964 | no_ip_extcommunity_list_standard_cmd, | |
9965 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
9966 | NO_STR | |
9967 | IP_STR | |
9968 | EXTCOMMUNITY_LIST_STR | |
9969 | "Extended Community list number (standard)\n" | |
9970 | "Specify community to reject\n" | |
9971 | "Specify community to accept\n" | |
9972 | EXTCOMMUNITY_VAL_STR) | |
9973 | { | |
9974 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
9975 | } | |
9976 | ||
9977 | DEFUN (no_ip_extcommunity_list_expanded, | |
9978 | no_ip_extcommunity_list_expanded_cmd, | |
9979 | "no ip extcommunity-list <100-199> (deny|permit) .LINE", | |
9980 | NO_STR | |
9981 | IP_STR | |
9982 | EXTCOMMUNITY_LIST_STR | |
9983 | "Extended Community list number (expanded)\n" | |
9984 | "Specify community to reject\n" | |
9985 | "Specify community to accept\n" | |
9986 | "An ordered list as a regular-expression\n") | |
9987 | { | |
9988 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
9989 | } | |
9990 | ||
9991 | DEFUN (no_ip_extcommunity_list_name_standard, | |
9992 | no_ip_extcommunity_list_name_standard_cmd, | |
9993 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
9994 | NO_STR | |
9995 | IP_STR | |
9996 | EXTCOMMUNITY_LIST_STR | |
9997 | "Specify standard extcommunity-list\n" | |
9998 | "Extended Community list name\n" | |
9999 | "Specify community to reject\n" | |
10000 | "Specify community to accept\n" | |
10001 | EXTCOMMUNITY_VAL_STR) | |
10002 | { | |
10003 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
10004 | } | |
10005 | ||
10006 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
10007 | no_ip_extcommunity_list_name_expanded_cmd, | |
10008 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
10009 | NO_STR | |
10010 | IP_STR | |
10011 | EXTCOMMUNITY_LIST_STR | |
10012 | "Specify expanded extcommunity-list\n" | |
10013 | "Community list name\n" | |
10014 | "Specify community to reject\n" | |
10015 | "Specify community to accept\n" | |
10016 | "An ordered list as a regular-expression\n") | |
10017 | { | |
10018 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
10019 | } | |
10020 | ||
10021 | void | |
10022 | extcommunity_list_show (struct vty *vty, struct community_list *list) | |
10023 | { | |
10024 | struct community_entry *entry; | |
10025 | ||
10026 | for (entry = list->head; entry; entry = entry->next) | |
10027 | { | |
10028 | if (entry == list->head) | |
10029 | { | |
10030 | if (all_digit (list->name)) | |
10031 | vty_out (vty, "Extended community %s list %s%s", | |
10032 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
10033 | "standard" : "(expanded) access", | |
10034 | list->name, VTY_NEWLINE); | |
10035 | else | |
10036 | vty_out (vty, "Named extended community %s list %s%s", | |
10037 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
10038 | "standard" : "expanded", | |
10039 | list->name, VTY_NEWLINE); | |
10040 | } | |
10041 | if (entry->any) | |
10042 | vty_out (vty, " %s%s", | |
10043 | community_direct_str (entry->direct), VTY_NEWLINE); | |
10044 | else | |
10045 | vty_out (vty, " %s %s%s", | |
10046 | community_direct_str (entry->direct), | |
10047 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
10048 | entry->u.ecom->str : entry->config, | |
10049 | VTY_NEWLINE); | |
10050 | } | |
10051 | } | |
10052 | ||
10053 | DEFUN (show_ip_extcommunity_list, | |
10054 | show_ip_extcommunity_list_cmd, | |
10055 | "show ip extcommunity-list", | |
10056 | SHOW_STR | |
10057 | IP_STR | |
10058 | "List extended-community list\n") | |
10059 | { | |
10060 | struct community_list *list; | |
10061 | struct community_list_master *cm; | |
10062 | ||
10063 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_AUTO); | |
10064 | if (! cm) | |
10065 | return CMD_SUCCESS; | |
10066 | ||
10067 | for (list = cm->num.head; list; list = list->next) | |
10068 | extcommunity_list_show (vty, list); | |
10069 | ||
10070 | for (list = cm->str.head; list; list = list->next) | |
10071 | extcommunity_list_show (vty, list); | |
10072 | ||
10073 | return CMD_SUCCESS; | |
10074 | } | |
10075 | ||
10076 | DEFUN (show_ip_extcommunity_list_arg, | |
10077 | show_ip_extcommunity_list_arg_cmd, | |
10078 | "show ip extcommunity-list (<1-199>|WORD)", | |
10079 | SHOW_STR | |
10080 | IP_STR | |
10081 | "List extended-community list\n" | |
10082 | "Extcommunity-list number\n" | |
10083 | "Extcommunity-list name\n") | |
10084 | { | |
10085 | struct community_list *list; | |
10086 | ||
10087 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_AUTO); | |
10088 | if (! list) | |
10089 | { | |
10090 | vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE); | |
10091 | return CMD_WARNING; | |
10092 | } | |
10093 | ||
10094 | extcommunity_list_show (vty, list); | |
10095 | ||
10096 | return CMD_SUCCESS; | |
10097 | } | |
10098 | \f | |
10099 | /* Return configuration string of community-list entry. */ | |
fd79ac91 | 10100 | static const char * |
718e3744 | 10101 | community_list_config_str (struct community_entry *entry) |
10102 | { | |
fd79ac91 | 10103 | const char *str; |
718e3744 | 10104 | |
10105 | if (entry->any) | |
10106 | str = ""; | |
10107 | else | |
10108 | { | |
10109 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
10110 | str = community_str (entry->u.com); | |
10111 | else | |
10112 | str = entry->config; | |
10113 | } | |
10114 | return str; | |
10115 | } | |
10116 | ||
10117 | /* Display community-list and extcommunity-list configuration. */ | |
10118 | int | |
10119 | community_list_config_write (struct vty *vty) | |
10120 | { | |
10121 | struct community_list *list; | |
10122 | struct community_entry *entry; | |
10123 | struct community_list_master *cm; | |
10124 | int write = 0; | |
10125 | ||
10126 | /* Community-list. */ | |
10127 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_AUTO); | |
10128 | ||
10129 | for (list = cm->num.head; list; list = list->next) | |
10130 | for (entry = list->head; entry; entry = entry->next) | |
10131 | { | |
10132 | if (atol (list->name) < 200) | |
10133 | vty_out (vty, "ip community-list %s %s %s%s", | |
10134 | list->name, community_direct_str (entry->direct), | |
10135 | community_list_config_str (entry), | |
10136 | VTY_NEWLINE); | |
10137 | else | |
10138 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
10139 | entry->style == COMMUNITY_LIST_STANDARD | |
10140 | ? "standard" : "expanded", | |
10141 | list->name, community_direct_str (entry->direct), | |
10142 | community_list_config_str (entry), | |
10143 | VTY_NEWLINE); | |
10144 | write++; | |
10145 | } | |
10146 | for (list = cm->str.head; list; list = list->next) | |
10147 | for (entry = list->head; entry; entry = entry->next) | |
10148 | { | |
10149 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
10150 | entry->style == COMMUNITY_LIST_STANDARD | |
10151 | ? "standard" : "expanded", | |
10152 | list->name, community_direct_str (entry->direct), | |
10153 | community_list_config_str (entry), | |
10154 | VTY_NEWLINE); | |
10155 | write++; | |
10156 | } | |
10157 | ||
10158 | /* Extcommunity-list. */ | |
10159 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_AUTO); | |
10160 | ||
10161 | for (list = cm->num.head; list; list = list->next) | |
10162 | for (entry = list->head; entry; entry = entry->next) | |
10163 | { | |
10164 | if (atol (list->name) < 200) | |
10165 | vty_out (vty, "ip extcommunity-list %s %s %s%s", | |
10166 | list->name, community_direct_str (entry->direct), | |
10167 | community_list_config_str (entry), VTY_NEWLINE); | |
10168 | else | |
10169 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
10170 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
10171 | ? "standard" : "expanded", | |
10172 | list->name, community_direct_str (entry->direct), | |
10173 | community_list_config_str (entry), VTY_NEWLINE); | |
10174 | write++; | |
10175 | } | |
10176 | for (list = cm->str.head; list; list = list->next) | |
10177 | for (entry = list->head; entry; entry = entry->next) | |
10178 | { | |
10179 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
10180 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
10181 | ? "standard" : "expanded", | |
10182 | list->name, community_direct_str (entry->direct), | |
10183 | community_list_config_str (entry), VTY_NEWLINE); | |
10184 | write++; | |
10185 | } | |
10186 | return write; | |
10187 | } | |
10188 | ||
10189 | struct cmd_node community_list_node = | |
10190 | { | |
10191 | COMMUNITY_LIST_NODE, | |
10192 | "", | |
10193 | 1 /* Export to vtysh. */ | |
10194 | }; | |
10195 | ||
10196 | void | |
10197 | community_list_vty () | |
10198 | { | |
10199 | install_node (&community_list_node, community_list_config_write); | |
10200 | ||
10201 | /* Community-list. */ | |
10202 | install_element (CONFIG_NODE, &ip_community_list_cmd); | |
10203 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); | |
10204 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
10205 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
10206 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
10207 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
10208 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
10209 | install_element (CONFIG_NODE, &no_ip_community_list_all_cmd); | |
10210 | install_element (CONFIG_NODE, &no_ip_community_list_name_all_cmd); | |
10211 | install_element (CONFIG_NODE, &no_ip_community_list_cmd); | |
10212 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); | |
10213 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
10214 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
10215 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
10216 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
10217 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
10218 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
10219 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
10220 | ||
10221 | /* Extcommunity-list. */ | |
10222 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
10223 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
10224 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
10225 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
10226 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
10227 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
10228 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_all_cmd); | |
10229 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_all_cmd); | |
10230 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); | |
10231 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
10232 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
10233 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
10234 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
10235 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
10236 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
10237 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
10238 | } |