Skip to content
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

OkHttpServer defaults to using ipv6 addresses, but during Google CTS testing, system applications are not allowed to use ipv6, resulting in CTS being unable to pass #597

Open
SJLBenjamin opened this issue Apr 28, 2024 · 1 comment

Comments

@SJLBenjamin
Copy link

GRPC create HttpServer:

public final class OkHttpServerProvider extends ServerProvider {

@OverRide
protected NewServerBuilderResult newServerBuilderForPort(int port, ServerCredentials creds) {

return NewServerBuilderResult.serverBuilder(
...
    //todo  defaults to using an ipv6 address
    new OkHttpServerBuilder(new InetSocketAddress(port), result.factory));

}
}

CTS Test:
java.lang.AssertionError: on-device tests failed:
android.appsecurity.cts.listeningports.ListeningPortsTest#testNoAccessibleListeningPorts:
android.appsecurity.cts.listeningports.ListeningPortsTest$ListeningPortsAssertionError:
Found port listening on addr=::, port=55231, UID=1000 [....]
at android.appsecurity.cts.listeningports.ListeningPortsTest.testNoAccessibleListeningPorts(ListeningPortsTest.java:170)

at android.appsecurity.cts.Utils.runDeviceTests(Utils.java:129)
at android.appsecurity.cts.Utils.runDeviceTests(Utils.java:75)
at android.appsecurity.cts.Utils.runDeviceTests(Utils.java:63)
at android.appsecurity.cts.ListeningPortsTest.assertNoAccessibleListeningPorts(ListeningPortsTest.java:225)
at android.appsecurity.cts.ListeningPortsTest.testNoRemotelyAccessibleListeningTcp6Ports(ListeningPortsTest.java:101)

Please provide a method of using only IPV4 as the server

@ejona86
Copy link
Member

ejona86 commented Sep 9, 2024

grpc-kotlin doesn't involve itself with this. This issue should be discussed on the grpc-java repository.

The server should be listening on all addresses. Disallowing IPv6 and allowing IPv4 sounds suspicious. Why do you think IPv4 would work?

You can use OkHttpServerBuilder.forPort(SocketAddress, ServerCredentials) to bind to IPv4-only. Make a SocketAddress with the specific IP you want to bind to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants