-
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
Conversation
Allow the specification of a VRF_ALL to be used for CLI. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The show_adj_route_vpn function is only currently used in conjunction with the KEEP_OLD_VPN_COMMANDS #define. Add this function to that define for the moment. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The bgp_parse_safi function is never called remove it. Especially as that later commits will properly handle what this function was trying to do. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The parser was incorrect for the 'set ... vpn nexthop ...' commands. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Create bgp_vty_find_and_parse_afi_safi_vrf that will parse the `show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]]' part of a command and to return the correct spot we are in the command. Cleanup 'dampening parameters' part of this command. Consolidate the creation of the bgp data structure to be a bit cleaner. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Cleanup the bgp bestpath or multipath show commands. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Fix this command to use the correct format for a show command. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
1) Make [<view|vrf> WORD] consistent 2) Fix inconsistent help string 3) Fix the show .. vrf all command Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Continous 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-113/ This is a comment from an EXPERIMENTAL automated CI system. |
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Continous 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-115/ This is a comment from an EXPERIMENTAL automated CI system. |
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.
Why:
+#define VRF_ALL UINT16_MAX - 1
} | ||
|
||
if (*vrf == VRF_UNKNOWN) | ||
{ |
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.
how do you initialise vrf in the case vrf_name is already null ( commands with no vrf at all)?
I would lie the *vrf value to be set inside that function.
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.
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.
} | ||
} | ||
else | ||
bgp = 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.
what happens in the case the command i use is a command without vrf either view parameter.
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.
then the default value specified at the top of the function is used for the lookup.
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.
It look like the change to pass in bgp to bgp_show_route can result in NULL deference. See line 9039. Suggest that bgp_show_route handle case of NULL bgp pointer (by getting default instance if 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.
shouldn't line 8078 result in an error message and return, and not run on with bgp == 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.
This pattern is repeated in a number of places -- all need to be fixed. Perhaps a subroutine is a good idea?
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.
yeah I thought about adding bgp into the parameters for bgp_vty_find_and_parse_afi_safi_vrf and then I realized that I wanted to come back through after we've fixed up more of the cli so I can make sure I have the pattern right.
if (!idx) | ||
{ | ||
vty_out (vty, "View/Vrf Specified: %s is unknown", argv[5]->arg); | ||
return CMD_WARNING; |
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.
can the number be set as an index value ? idx_val ?
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 probably wrong. I'll see what I can fix up.
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.
A pedantic comment WRT vrf.h:
I think it would be best to
- define VRF_UNKNOWN as VRF_MAX and VRF_MAX be some less than 2^16-1
- that special values be defined above VRF_MAX
- that the config interface prevent config of >= VRF_MAX
@louberger To answer your question why MAX_INT -1? The VRF_UNKNOWN is MAX_INT so I couldn't use that value. |
The use of this function was causing some confusion. As such let's add some documentation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
When bgp_vty_find_and_parse_afi_safi_vrf detects a invalidly named vrf, it warns the user. There is no need for the calling function to warn again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Continous 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-127/ This is a comment from an EXPERIMENTAL automated CI system. |
if (argv_find(argv, argc, "community-list", &idx)) | ||
{ | ||
const char *clist_number_or_name = argv[++idx]->arg; | ||
if (++idx < argc && strmatch (argv[idx]->arg, "exact-match")) |
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.
argv[idx]->text
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.
* | ||
* The function returns the correct location in the parse tree for the | ||
* last token found. | ||
*/ |
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.
I will add this in a follow up commit, thanks for the reminder.
…On Thu, Jan 26, 2017 at 10:32 AM, Philippe Guibert ***@***.*** > wrote:
***@***.**** commented on this pull request.
------------------------------
In bgpd/bgp_vty.c
<#107 (review)>
:
> + * [<view|vrf> WORD]
+ * [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]]
+ * The command parsing should still be ok.
+ *
+ * vty -> The vty for the command so we can output some useful data in
+ * the event of a parse error in the vrf.
+ * argv -> The command tokens
+ * argc -> How many command tokens we have
+ * idx -> The current place in the command, generally should be 0 for this function
+ * afi -> The parsed afi if it was included in the show command, returned here
+ * safi -> The parsed safi if it was included in the show command, returned here
+ * vrf -> The parsed vrf id if it was included in the show command, returned here
+ *
+ * The function returns the correct location in the parse tree for the
+ * last token found.
+ */
1 . returns 0 if error.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#107 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKHDUNSN9oH5KQHa-lxrEX1KFhCTgMH7ks5rWLxzgaJpZM4Lr1CB>
.
|
Continous 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-137/ This is a comment from an EXPERIMENTAL automated CI system. |
1 similar comment
Continous 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-137/ This is a comment from an EXPERIMENTAL automated CI system. |
This fix addresses these things: 1) Clean up documentation as requested 2) Fix a wrong search for "exact-match" 3) Fix possible crash. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@louberger I fixed the crash you noticed that could happen. |
Continous Integration Result: FAILEDSee below for issues. This is a comment from an EXPERIMENTAL automated CI system. Get source and apply patch from patchwork: SuccessfulBuilding Stage: FailedOmniOS amd64 build: Successful Ubuntu1604 amd64 build: FailedUbuntu1604 amd64 build: Unknown Log <log_configure.txt> |
Continous 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-140/ This is a comment from an EXPERIMENTAL automated CI system. |
Convert the idx to &idx to make our api more consistent Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@@ -260,9 +260,12 @@ bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, i | |||
if (*vrf == VRF_UNKNOWN) | |||
{ | |||
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 comment
The 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 comment
The 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 comment
The 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 comment
The 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 )
Add asserts to how I expect bgp_vty_find_and_parse_afi_safi to be used. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Continous 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-145/ This is a comment from an EXPERIMENTAL automated CI system. |
@@ -237,6 +237,10 @@ bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, i | |||
{ | |||
char *vrf_name = NULL; | |||
|
|||
assert (afi); | |||
assert (safi); | |||
assert (*vrf == VRF_UNKNOWN); |
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.
don't you mean != VRF_UNKNOWN?
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Continous 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-146/ This is a comment from an EXPERIMENTAL automated CI system. |
Continous 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-148/ This is a comment from an EXPERIMENTAL automated CI system. |
No description provided.