Skip to content

Commit

Permalink
bgpd: clear ip bgp instances with invalid safi
Browse files Browse the repository at this point in the history
This commit fixes the handling of incoming parameters passed in
following vty functions:

clear ip bgp ipv6 [safi] prefix []
clear ip bgp [vrf ] ipv6 [safi] prefix []

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
  • Loading branch information
pguibert6WIND committed Mar 7, 2018
1 parent c98f4d8 commit 9b475e7
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions bgpd/bgp_vty.c
Expand Up @@ -6413,11 +6413,16 @@ DEFUN (clear_bgp_ipv6_safi_prefix,
"Clear bestpath and re-advertise\n"
"IPv6 prefix\n")
{
int idx_safi = 3;
int idx_ipv6_prefixlen = 5;
int idx_safi = 0;
int idx_ipv6_prefix = 0;
safi_t safi = SAFI_UNICAST;
char *prefix = argv_find(argv, argc, "X:X::X:X/M", &idx_ipv6_prefix) ?
argv[idx_ipv6_prefix]->arg : NULL;

argv_find_and_parse_safi(argv, argc, &idx_safi, &safi);
return bgp_clear_prefix(
vty, NULL, argv[idx_ipv6_prefixlen]->arg, AFI_IP6,
bgp_vty_safi_from_str(argv[idx_safi]->text), NULL);
vty, NULL, prefix, AFI_IP6,
safi, NULL);
}

DEFUN (clear_bgp_instance_ipv6_safi_prefix,
Expand All @@ -6433,11 +6438,20 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix,
"IPv6 prefix\n")
{
int idx_word = 3;
int idx_safi = 5;
int idx_ipv6_prefixlen = 7;
int idx_safi = 0;
int idx_ipv6_prefix = 0;
safi_t safi = SAFI_UNICAST;
char *prefix = argv_find(argv, argc, "X:X::X:X/M", &idx_ipv6_prefix) ?
argv[idx_ipv6_prefix]->arg : NULL;
/* [<view|vrf> VIEWVRFNAME] */
char *vrfview = argv_find(argv, argc, "VIEWVRFNAME", &idx_word) ?
argv[idx_word]->arg : NULL;

argv_find_and_parse_safi(argv, argc, &idx_safi, &safi);

return bgp_clear_prefix(
vty, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg,
AFI_IP6, bgp_vty_safi_from_str(argv[idx_safi]->text), NULL);
vty, vrfview, prefix,
AFI_IP6, safi, NULL);
}

DEFUN (show_bgp_views,
Expand Down

0 comments on commit 9b475e7

Please sign in to comment.