Add test to ensure DHCP packet with DF set is passed
Adds a test to ensure a DHCP packet with DF flag set is passed.
Test: test only CL, TH.
Bug: 356278038
Change-Id: I8f1b224552587fa49235bed4a1cec0fa55aee6bc
diff --git a/tests/unit/src/android/net/apf/ApfFilterTest.kt b/tests/unit/src/android/net/apf/ApfFilterTest.kt
index f1f0e67..5e0f883 100644
--- a/tests/unit/src/android/net/apf/ApfFilterTest.kt
+++ b/tests/unit/src/android/net/apf/ApfFilterTest.kt
@@ -396,6 +396,25 @@
PASSED_IPV4_FROM_DHCPV4_SERVER
)
+ // Duplicate of dhcp4Pkt with DF flag set.
+ val dhcp4PktDf = """
+ ffffffffffff00112233445508004500012e000140004011b815c0a80101ffffffff0043
+ 0044011a5ffc02010600000000000000000000000000c0a80164c0a80101000000000011
+ 223344550000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000638253633501023604c0
+ a801010104ffffff000304c0a80101330400015180060408080808ff
+ """.replace("\\s+".toRegex(), "").trim()
+ verifyProgramRun(
+ apfFilter.mApfVersionSupported,
+ program,
+ HexDump.hexStringToByteArray(dhcp4PktDf),
+ PASSED_IPV4_FROM_DHCPV4_SERVER
+ )
+
// Using scapy to generate DHCP4 offer packet:
// eth = Ether(src="E8:9F:80:66:60:BB", dst="01:00:5E:00:00:FB")
// ip = IP(src="192.168.1.10", dst="192.168.1.20") # IPv4