-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bgpafisafi #107
Bgpafisafi #107
Changes from 1 commit
ece35fd
9dd6d53
3289141
9fa4d33
af46294
c41247f
b00b230
f2a8972
e01ca20
30a6a16
08435c2
7eeee51
c493f2d
7f12cb2
0e37c25
9317e17
b4898a3
69d143a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,22 +232,22 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t | |
* it found the last token. | ||
*/ | ||
int | ||
bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, int argc, int idx, | ||
bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, int argc, int *idx, | ||
afi_t *afi, safi_t *safi, vrf_id_t *vrf) | ||
{ | ||
char *vrf_name = NULL; | ||
|
||
if (argv_find (argv, argc, "ip", &idx)) | ||
if (argv_find (argv, argc, "ip", idx)) | ||
*afi = AFI_IP; | ||
|
||
if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) | ||
if (argv_find (argv, argc, "view", idx) || argv_find (argv, argc, "vrf", idx)) | ||
{ | ||
vrf_name = argv[idx + 1]->arg; | ||
idx += 2; | ||
vrf_name = argv[*idx + 1]->arg; | ||
*idx += 2; | ||
} | ||
|
||
if (argv_find_and_parse_afi (argv, argc, &idx, afi)) | ||
argv_find_and_parse_safi (argv, argc, &idx, safi); | ||
if (argv_find_and_parse_afi (argv, argc, idx, afi)) | ||
argv_find_and_parse_safi (argv, argc, idx, safi); | ||
|
||
if (vrf_name) | ||
{ | ||
|
@@ -260,9 +260,12 @@ bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, i | |
if (*vrf == VRF_UNKNOWN) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how do you initialise vrf in the case vrf_name is already null ( commands with no vrf at all)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not believe this is the right thing to do. Only the calling function knows what the right defaults are for the afi/safi/vrf due to we assume different defaults based upon the command. This approach would break the ability for the calling function to do the right thing. As I stated I will update the Pull Request with better documentation for this funciton. |
||
vty_out (vty, "View/Vrf specified is unknown: %s", vrf_name); | ||
*idx = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why set idx to null here? Isn't the return value of zero sufficient? For that matter, why do anything special here, the caller can check each of {afi, safi, vrf} as they see fit.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that is not setting it to null. I'm setting the value of what is pointed at to 0. Very different There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry too many threads going on, was thinking about the next comment I was going to write on this (WRT bgp = NULL). the comment still applies, please read "why set *idx = 0 to here ..." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because it's the error case? We were unable to figure out what vrf was specified( the last line in the doc ) |
||
return 0; | ||
} | ||
return idx + 1; | ||
|
||
*idx += 1; | ||
return *idx; | ||
} | ||
|
||
static int | ||
|
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.
1 . returns 0 if error.
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.
Fixed message.