Repository navigation
Android e2e: a peer that serves each connection on its own (#173) - #183
Conversation
The 'start() after stop()' failures on the Android 5.0 emulator were the test's peer, not Android. The peer served one connection at a time (while true; do echo peer-ok | nc -l -p 9000; done). A connection the app opened just before stop() lost its app side with the VPN; the peer's nc waited on it (FIN_WAIT1) for minutes, nothing listened on port 9000, and every new connection got a reset (ECONNREFUSED). A packet capture on the emulator showed the app's new sockets going through tun0 with the tunnel address all along, and ip rule and the routes were the same as in passing runs. - The peer is 'nc -lk -p 9000 -e echo peer-ok': a process per connection. - TunnelE2eTest wants the peer after start() after stop() on Android 5.0 too; the KNOWN case of the script is gone. - docs/android-library.md: the Android 5.0 note keeps the real part (a connection opened right at CONNECTED may leave outside the VPN; a new one goes through it). Closes #173
PR Summary by QodoMake the Android e2e peer serve connections independently
AI Description
Merge Risk
|
Code Review by Qodo
1. Android 5.0 fix is verified only on an emulator
|
|
Qodo's findings, answered without changes:
|
Closes #173.
The "start() after stop()" failures on the Android 5.0 emulator came from the test's peer, not from Android or the library.
What happened. The peer handled one connection at a time (
while true; do echo peer-ok | nc -l -p 9000; done). A connection the app opened just beforestop()lost its app side when the VPN was torn down. The peer'snckept waiting on it (FIN_WAIT1, 9 bytes unsent) for minutes. Meanwhile nothing listened on port 9000, so every new connection got a reset andECONNREFUSED.Evidence from a failing run on API 21:
start(), the app's new sockets went throughtun0with the tunnel address (10.200.0.3), and the peer answered each SYN with RST.netstatin the peer's container at the same time: no listener on 9000; the onlyncheld a connection from the app's previous address (10.200.0.4) inFIN_WAIT1.ip ruleand all routing tables were identical in passing and failing runs.The real Android 5.0 part. A connection opened right at
CONNECTEDmay leave througheth0, before the VPN's rules apply. Its retries then reach the tunnel with 10.0.2.15 as source, and the server drops them (the "source address 10.0.2.15" lines in the issue). The next connection goes through the tunnel. The test'saskPeer()already retries.Changes (tests and docs only, no release):
tests/android/tunnel-e2e.sh: the peer isnc -lk -p 9000 -e echo peer-ok, a process per connection; theKNOWN (#173)case is gone.TunnelE2eTest:start()afterstop()must reach the peer on Android 5.0 too.docs/android-library.md: the Android 5.0 note keeps only the real part.Tested locally on the emulator (Docker):