grpc-java
grpc-java copied to clipboard
gRPC-okhttp ipv6 link local scope
What version of gRPC-Java are you using?
1.45.0
What is your environment?
MacOS jdk 8
What did you expect to see?
I expect gRPC-okhttp be able to work with ipv6 link local with scope
What did you see instead?
AndroidNegotiator inside OkHttpProtocolNegotiator.java class is using SNI_HOST_NAME.newInstance(hostname) which throws exception because SNIHostName(String hostname) doesn't accept "%" and we need that for scoping ipv6 link local.
Suggestion would be using SNIHostName(byte[] encoded). To do so we would need to replace line 252 to SNI_HOST_NAME.newInstance(hostname.getBytes())
Steps to reproduce the bug
Any connection that uses configureTlsExtensions from AndroidNegotiator class which uses ipv6 link local with scoping like "%wlan0"
The constructor was looked up (using reflection) as Class.forName("javax.net.ssl.SNIHostName").getConstructor(String.class) on line 197. That will need to be changed to look up a constructor with byte[] type before your suggested change can be made.
Could you create a PR after testing your change works?
@sanjaypujare I checked locally and that was the issue, I was able to connect successfully after making your and mine suggestion. I'll open a PR soon. Thank you.
PR open https://github.com/grpc/grpc-java/pull/9326
@sanjaypujare could you help me with the PR checks failing? I'm not familiar with them.
with the PR checks failing
Which checks are failing?
I was able to solve, thank you. Waiting approval from the reviewer.