Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
xds: listener type validation #11933
base: master
Are you sure you want to change the base?
xds: listener type validation #11933
Changes from 7 commits
4eb625a
ad90963
01927a6
8780c52
76270a4
da0d5ab
ba8af22
694c2f1
506bbe4
87aad6f
239f167
ca5bb14
cb41652
e07158f
9f79e8c
d8fb13a
6873d59
b3908f1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
For my education: what would be the "best/most appropriate" behaviour if the String
ldsAddress
is the empty string ornull
?Currently, if
ldsAddress
isnull
, we skipipAddressesMatch
entirely and proceed with the remaining logic. Would this still be fine?Likewise, if
ldsAddress
is the empty string, we checkipAddressesMatch
, AFAIK, this would throw an exception and would this be fine?HostAndPort.fromString
would return aHostAndPort(host="", port=-1, hasBracketlessColons=false)
thenInetAddresses.forString
would throw anIllegalArgumentException
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.
Hmmm. Good point. I couldn't find any mention about this case in gRFC A36.
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.
ldsAddress == null
means (based on XdsListenerResource) that the address type was not a SocketAddress, which is covered in the gRFC.In most NR/LB logic, exceptions cause the channel to go into panic mode. NR/LB should only throw in case of a bug.
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.
Empty address is disallowed in the proto, but is not in our validation so we should add validation. The ip matching logic here should also be checking that it is a TCP listener, which is not being communicated through EnvoyServerData.Address.
And the validation should probably be NACKing (throw
ResourceInvalidException
) NAMED_PORT as gRPC does not supportresolver_name
, which is mentioned as being required to use it in its documentation.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 we check if it is a TCP listener?
if ("raw_buffer".equals(update.listener().filterChains().get(0).filterChainMatch().transportProtocol()))
this could tell us but I'm not very sure about this. I could have pasted the above condition with default filter chain but that is a Nullable field.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 gRPC code is always TCP. So we need to not match when xDS tells us to use UDP.
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 transport protocol doesn't seem to be about TCP vs UDP. That's
raw_buffer
ortls
: the higher-level protocol. And that is part of filter chain matches; used to select which filter chain to use. You should never loop through all the matchers and then copy details about it to other matchers.We were talking about the address, and SocketAddress has a TCP vs UDP
protocol
.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.
Got it.
You said we need not match addresses when it's UDP, so I assume we don't call
handleConfigNotFoundOrMismatch
when it's UDP and continue?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 don't understand. If you don't call
handleConfigNotFoundOrMismatch
, that's the same as matching... If!ipAddressesMatch()
you callhandleConfigNotFoundOrMismatch
. Why would you not call it?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.
Yep. I was thinking right at first before editing the comment and then I messed up with thoughts.
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 I said before, remove the wildcard handling. IPv4 and IPv6 wildcards behave differently, and you aren't checking the port here. And if we need to be comparing wildcards, we would really need to spell out how that is done in the gRFC to be consistent cross-language.
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.
nit: what would be the reason to switch the order of the error format here? I think
Listener %s
is slightly more common in the code base. Consistent formatting helps with searching when debugging issues.