Skip to content
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: Actually find the sequence number for large-community-list #6669

Merged
merged 2 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -17332,8 +17332,7 @@ static int lcommunity_list_set_vty(struct vty *vty, int argc,
char *cl_name;
char *seq = NULL;

argv_find(argv, argc, "(1-4294967295)", &idx);
if (idx)
if (argv_find(argv, argc, "(1-4294967295)", &idx))
seq = argv[idx]->arg;

idx = 0;
Expand Down Expand Up @@ -17382,8 +17381,7 @@ static int lcommunity_list_unset_vty(struct vty *vty, int argc,
int idx = 0;
char *seq = NULL;

argv_find(argv, argc, "(1-4294967295)", &idx);
if (idx)
if (argv_find(argv, argc, "(1-4294967295)", &idx))
seq = argv[idx]->arg;

idx = 0;
Expand Down
16 changes: 16 additions & 0 deletions tools/coccinelle/argv_find.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@@
identifier idx;
identifier argv;
identifier argc;
expression e1;
expression e2;
@@

- argv_find(argv, argc, e1, &idx);
if (
- idx
+ argv_find(argv, argc, e1, &idx)
)
{
e2;
}