Update the integration test to verify zero-length DHCP packet.
DHCP packet listener doesn't close socket any more upon receiving a
zero-length DHCP packet with a fix, instead, just ignore the zero-length
packet and continue reading. Also update the integration test logic to
verify the new behavior, i.e. we can send DHCPDISCOVER from a second device
with different mac address to verify the upstream DHCP server doesn't close
the listening socket, and then we will receive the response from server e.g.
DHCPOFFER packet.
Bug: 269692093
Test: atest TetheringIntegrationTests
Change-Id: I183da43ce5a6511714d293318fe6c60ea55999c0
diff --git a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
index 21927df..4ee5c42 100644
--- a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
+++ b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
@@ -39,7 +39,6 @@
import static com.android.net.module.util.NetworkStackConstants.IPV4_LENGTH_OFFSET;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -871,10 +870,10 @@
final ByteBuffer packet = ByteBuffer.wrap(ZeroLengthDhcpPacket);
tester.sendUploadPacket(packet);
- // Send DHCPDISCOVER packet from another downstream tethered device to verify that upstream
- // DHCP server has closed the listening socket and stopped reading, then we will not receive
- // any DHCPOFFER in this case.
+ // Send DHCPDISCOVER packet from another downstream tethered device to verify that
+ // upstream DHCP server doesn't close the listening socket and stop reading, then we
+ // can still receive the next DHCP packet from server.
final MacAddress macAddress = MacAddress.fromString("11:22:33:44:55:66");
- assertFalse(tester.testDhcpServerAlive(macAddress));
+ assertTrue(tester.testDhcpServerAlive(macAddress));
}
}