Addressing feedback on IpStructure
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.StructTest Flag: EXEMPT refactor Bug: 392509494 Change-Id: Iaa301f7b4fadd2aaeac326bf07fbcc4ee32fa4d7
This commit is contained in:
parent
7bff7b2455
commit
73d2d4948c
1 changed files with 6 additions and 4 deletions
|
|
@ -123,8 +123,8 @@ public class Struct {
|
|||
EUI48, // IEEE Extended Unique Identifier, a 48-bits long MAC address in network order
|
||||
Ipv4Address, // IPv4 address in network order
|
||||
Ipv6Address, // IPv6 address in network order
|
||||
IpAddress, // IP address in network order. IPv4 address is written to byte format as
|
||||
// v4-mapped-v6 address. IpAddress should be used over Ipv6Address when
|
||||
IpAddress, // IP address in network order. IPv4 address is written to byte format as
|
||||
// v4-mapped-v6 address. IpAddress should be used over Ipv6Address when
|
||||
// the field wants to contain both v4 and v6 addresses.
|
||||
}
|
||||
|
||||
|
|
@ -552,9 +552,11 @@ public class Struct {
|
|||
output.put(address);
|
||||
break;
|
||||
case IpAddress:
|
||||
InetAddress inetAddress = (InetAddress) value;
|
||||
if (inetAddress instanceof Inet4Address) {
|
||||
final InetAddress inetAddress;
|
||||
if (value instanceof Inet4Address) {
|
||||
inetAddress = InetAddressUtils.v4MappedV6Address((Inet4Address) value);
|
||||
} else {
|
||||
inetAddress = (InetAddress) value;
|
||||
}
|
||||
output.put(inetAddress.getAddress());
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue