Handle non IPv6 packet in getRaPios

Bug: 338061061

Test: atest ThreadNetworkIntegrationTests:android.net.thread.BorderRoutingTest

Change-Id: Ia637dc8ec4cca919bd1957148ec2c104ab1895ac
This commit is contained in:
Yang Sun 2024-12-06 02:16:45 +00:00
commit 5b018cfd06

View file

@ -388,7 +388,12 @@ object IntegrationTestUtils {
raMsg ?: return pioList
val buf = ByteBuffer.wrap(raMsg)
val ipv6Header = Struct.parse(Ipv6Header::class.java, buf)
val ipv6Header = try {
Struct.parse(Ipv6Header::class.java, buf)
} catch (e: IllegalArgumentException) {
// the packet is not IPv6
return pioList
}
if (ipv6Header.nextHeader != OsConstants.IPPROTO_ICMPV6.toByte()) {
return pioList
}