-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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?
Conversation
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, I didn't mean to approve
InetAddress listenerIp = InetAddresses.forString(listenerAddressHnP.getHost()); | ||
InetAddress ldsIp = InetAddresses.forString(ldsAddressHnP.getHost()); | ||
|
||
if (listenerIp.isAnyLocalAddress()) { |
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.
return; | ||
} | ||
|
||
String ldsAddress = update.listener().address(); |
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 or null
?
Currently, if ldsAddress
is null
, we skip ipAddressesMatch
entirely and proceed with the remaining logic. Would this still be fine?
Likewise, if ldsAddress
is the empty string, we check ipAddressesMatch
, AFAIK, this would throw an exception and would this be fine? HostAndPort.fromString
would return a HostAndPort(host="", port=-1, hasBracketlessColons=false)
then InetAddresses.forString
would throw an IllegalArgumentException
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.
@Override | ||
public void onResourceDoesNotExist(final String resourceName) { | ||
if (stopped) { | ||
return; | ||
} | ||
StatusException statusException = Status.UNAVAILABLE.withDescription( | ||
String.format("Listener %s unavailable, xDS node ID: %s", resourceName, | ||
String.format("%s listener unavailable, xDS node ID: %s", resourceName, |
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.
Fixes #11737