diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2018-03-02 15:43:07 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2018-03-07 15:58:48 +0100 |
commit | 9b475e76c6a49af4f48ca20b689b3f022cf8c2dd (patch) | |
tree | c77c3de0583daa9c31cc8933c051fac2eca74c8e /bgpd/bgp_vty.c | |
parent | Merge pull request #1784 from donaldsharp/documentation (diff) | |
download | frr-9b475e76c6a49af4f48ca20b689b3f022cf8c2dd.tar.xz frr-9b475e76c6a49af4f48ca20b689b3f022cf8c2dd.zip |
bgpd: clear ip bgp instances with invalid safi
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>
Diffstat (limited to 'bgpd/bgp_vty.c')
-rw-r--r-- | bgpd/bgp_vty.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 15cc5673a..2f60871e8 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -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, @@ -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, |