-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bgpd: clear ip bgp instances with safi invalid #1816
Conversation
bgpd/bgp_vty.c
Outdated
@@ -6413,8 +6413,8 @@ 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 = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the wrong approach. safi can be 3 or 4. I would recommend searching for the safi string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bgpd/bgp_vty.c
Outdated
int idx_safi = 3; | ||
int idx_ipv6_prefixlen = 5; | ||
int idx_safi = 4; | ||
int idx_ipv6_prefixlen = 6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, this can be 5 or 6 depending on how the function is called.
bgpd/bgp_vty.c
Outdated
int idx_word = 3; | ||
int idx_safi = 5; | ||
int idx_ipv6_prefixlen = 7; | ||
int idx_word = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same issues exist here and should be fixed in the same manner
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-2721/ This is a comment from an EXPERIMENTAL automated CI system. CLANG Static Analyzer Summary
No Changes in Static Analysis warnings compared to base19 Static Analyzer issues remaining.See details at |
06697cb
to
aa4ed1f
Compare
Hi Donald, |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-2724/ This is a comment from an EXPERIMENTAL automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings:
CLANG Static Analyzer Summary
No Changes in Static Analysis warnings compared to base19 Static Analyzer issues remaining.See details at |
aa4ed1f
to
f07f629
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
bgpd/bgp_vty.c
Outdated
int idx_safi = 5; | ||
int idx_ipv6_prefixlen = 7; | ||
int idx_safi; | ||
int idx_ipv6_prefix = 7; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you can avoid using indices entirely here, I would do so, as it'll avoid introducing bugs in the future when someone modifies the command and forgets to update the indices...you're already using argv_find()
so why not just get rid of the indices entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
bgpd/bgp_vty.c
Outdated
|
||
if (argv_find(argv, argc, "view", idx) | ||
|| argv_find(argv, argc, "vrf", idx)) { | ||
vrf_name = argv[*idx + 1]->arg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pointless, you can just do
argv_find(argv, argc, "VIEWVRFNAME", idx)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
bgpd/bgp_vty.c
Outdated
|
||
argv_find_and_parse_safi(argv, argc, &idx_safi, &safi); | ||
if (argv_find(argv, argc, "prefix", &idx_ipv6_prefix)) | ||
idx_ipv6_prefix += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the whole idea of argv_find
(and DEFPY
) is to avoid manual index calculations, here you can simply do
int idx = 0;
...
const char *prefix = argv_find(argv, argc, "X:X::X:X/M", &idx) ? argv[idx]->arg : NULL;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
bgpd/bgp_vty.c
Outdated
bgp_vty_find_and_parse_bgp(vty, argv, argc, &idx_word, &bgp); | ||
|
||
if (argv_find(argv, argc, "prefix", &idx_ipv6_prefix)) | ||
idx_ipv6_prefix += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-2726/ This is a comment from an EXPERIMENTAL automated CI system. CLANG Static Analyzer Summary
No Changes in Static Analysis warnings compared to base19 Static Analyzer issues remaining.See details at |
f07f629
to
266e6e4
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-2732/ This is a comment from an EXPERIMENTAL automated CI system. CLANG Static Analyzer Summary
No Changes in Static Analysis warnings compared to base19 Static Analyzer issues remaining.See details at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bgpd/bgp_vty.c
Outdated
int idx_safi; | ||
int idx_ipv6_prefix; | ||
safi_t safi = SAFI_UNICAST; | ||
char *prefix = argv_find(argv, argc, "X:X::X:X/M", &idx_ipv6_prefix) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is undefined behavior, you need to set idx_ipv6_prefix = 0
. You need to do the same for idx_safi
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
bgpd/bgp_vty.c
Outdated
int idx_safi = 5; | ||
int idx_ipv6_prefixlen = 7; | ||
int idx_safi; | ||
int idx_ipv6_prefix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here, both of these need to be set to zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
266e6e4
to
9b475e7
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
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>
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-2786/ This is a comment from an EXPERIMENTAL automated CI system. CLANG Static Analyzer Summary
No Changes in Static Analysis warnings compared to base19 Static Analyzer issues remaining.See details at |
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