Change IaPrefixOption prefix length type to byte.
Given the maximum prefix length of IPv6 address is 128 and it
should not be assigned via IA prefix option to client, so S8
is enough to represent the prefix-length field.
Bug: 260934173
Test: m
Change-Id: Ia7fc52f7495775f3a29141d75adffafd84c38a02
diff --git a/staticlibs/device/com/android/net/module/util/structs/IaPrefixOption.java b/staticlibs/device/com/android/net/module/util/structs/IaPrefixOption.java
index cd974e6..060d491 100644
--- a/staticlibs/device/com/android/net/module/util/structs/IaPrefixOption.java
+++ b/staticlibs/device/com/android/net/module/util/structs/IaPrefixOption.java
@@ -62,13 +62,13 @@
public final long preferred;
@Field(order = 3, type = Type.U32)
public final long valid;
- @Field(order = 4, type = Type.U8)
- public final short prefixLen;
+ @Field(order = 4, type = Type.S8)
+ public final byte prefixLen;
@Field(order = 5, type = Type.ByteArray, arraysize = 16)
public final byte[] prefix;
IaPrefixOption(final short code, final short length, final long preferred,
- final long valid, final short prefixLen, final byte[] prefix) {
+ final long valid, final byte prefixLen, final byte[] prefix) {
this.code = code;
this.length = length;
this.preferred = preferred;
@@ -81,7 +81,7 @@
* Build an IA_PD prefix option with given specific parameters.
*/
public static ByteBuffer build(final short length, final long preferred, final long valid,
- final short prefixLen, final byte[] prefix) {
+ final byte prefixLen, final byte[] prefix) {
final IaPrefixOption option = new IaPrefixOption((byte) DHCP6_OPTION_IAPREFIX,
length /* 25 + IAPrefix options length */, preferred, valid, prefixLen, prefix);
return ByteBuffer.wrap(option.writeToBytes(ByteOrder.BIG_ENDIAN));