Merge "Add include for connectivity parcelables"
diff --git a/common/moduleutils/src/android/net/ip/ConntrackMonitor.java b/common/moduleutils/src/android/net/ip/ConntrackMonitor.java
index 6020c3f..9189002 100644
--- a/common/moduleutils/src/android/net/ip/ConntrackMonitor.java
+++ b/common/moduleutils/src/android/net/ip/ConntrackMonitor.java
@@ -113,7 +113,7 @@
@Override
public String toString() {
- return "ConntrackEvent{ "
+ return "ConntrackEvent{"
+ "msg_type{"
+ NetlinkConstants.stringForNlMsgType(msgType, OsConstants.NETLINK_NETFILTER)
+ "}, "
@@ -122,7 +122,7 @@
+ "status{"
+ status + "(" + ConntrackMessage.stringForIpConntrackStatus(status) + ")"
+ "}, "
- + "timeout_sec{" + Integer.toUnsignedLong(timeoutSec) + "} "
+ + "timeout_sec{" + Integer.toUnsignedLong(timeoutSec) + "}"
+ "}";
}
diff --git a/common/moduleutils/src/android/net/shared/ProvisioningConfiguration.java b/common/moduleutils/src/android/net/shared/ProvisioningConfiguration.java
index 5f5699c..d3bc04d 100644
--- a/common/moduleutils/src/android/net/shared/ProvisioningConfiguration.java
+++ b/common/moduleutils/src/android/net/shared/ProvisioningConfiguration.java
@@ -29,6 +29,7 @@
import android.net.StaticIpConfiguration;
import android.net.apf.ApfCapabilities;
import android.net.ip.IIpClient;
+import android.net.networkstack.aidl.dhcp.DhcpOption;
import android.util.Log;
import java.nio.BufferUnderflowException;
@@ -227,6 +228,17 @@
}
/**
+ * Specify the customized DHCP options to be put in the PRL or in the DHCP packet. Options
+ * with null value will be put in the PRL.
+ *
+ * @param: options customized DHCP option stable parcelable list.
+ */
+ public Builder withDhcpOptions(List<DhcpOption> options) {
+ mConfig.mDhcpOptions = options;
+ return this;
+ }
+
+ /**
* Build the configuration using previously specified parameters.
*/
public ProvisioningConfiguration build() {
@@ -430,6 +442,7 @@
public String mDisplayName = null;
public ScanResultInfo mScanResultInfo;
public Layer2Information mLayer2Info;
+ public List<DhcpOption> mDhcpOptions;
public ProvisioningConfiguration() {} // used by Builder
@@ -451,6 +464,7 @@
mDisplayName = other.mDisplayName;
mScanResultInfo = other.mScanResultInfo;
mLayer2Info = other.mLayer2Info;
+ mDhcpOptions = other.mDhcpOptions;
}
/**
@@ -464,8 +478,8 @@
p.usingMultinetworkPolicyTracker = mUsingMultinetworkPolicyTracker;
p.usingIpReachabilityMonitor = mUsingIpReachabilityMonitor;
p.requestedPreDhcpActionMs = mRequestedPreDhcpActionMs;
- p.initialConfig = mInitialConfig == null ? null : mInitialConfig.toStableParcelable();
- p.staticIpConfig = mStaticIpConfig == null
+ p.initialConfig = (mInitialConfig == null) ? null : mInitialConfig.toStableParcelable();
+ p.staticIpConfig = (mStaticIpConfig == null)
? null
: new StaticIpConfiguration(mStaticIpConfig);
p.apfCapabilities = mApfCapabilities; // ApfCapabilities is immutable
@@ -473,8 +487,9 @@
p.ipv6AddrGenMode = mIPv6AddrGenMode;
p.network = mNetwork;
p.displayName = mDisplayName;
- p.scanResultInfo = mScanResultInfo == null ? null : mScanResultInfo.toStableParcelable();
- p.layer2Info = mLayer2Info == null ? null : mLayer2Info.toStableParcelable();
+ p.scanResultInfo = (mScanResultInfo == null) ? null : mScanResultInfo.toStableParcelable();
+ p.layer2Info = (mLayer2Info == null) ? null : mLayer2Info.toStableParcelable();
+ p.options = (mDhcpOptions == null) ? null : new ArrayList<>(mDhcpOptions);
return p;
}
@@ -492,7 +507,7 @@
config.mUsingIpReachabilityMonitor = p.usingIpReachabilityMonitor;
config.mRequestedPreDhcpActionMs = p.requestedPreDhcpActionMs;
config.mInitialConfig = InitialConfiguration.fromStableParcelable(p.initialConfig);
- config.mStaticIpConfig = p.staticIpConfig == null
+ config.mStaticIpConfig = (p.staticIpConfig == null)
? null
: new StaticIpConfiguration(p.staticIpConfig);
config.mApfCapabilities = p.apfCapabilities; // ApfCapabilities is immutable
@@ -502,6 +517,7 @@
config.mDisplayName = p.displayName;
config.mScanResultInfo = ScanResultInfo.fromStableParcelable(p.scanResultInfo);
config.mLayer2Info = Layer2Information.fromStableParcelable(p.layer2Info);
+ config.mDhcpOptions = (p.options == null) ? null : new ArrayList<>(p.options);
return config;
}
@@ -523,9 +539,32 @@
.add("mDisplayName: " + mDisplayName)
.add("mScanResultInfo: " + mScanResultInfo)
.add("mLayer2Info: " + mLayer2Info)
+ .add("mDhcpOptions: " + mDhcpOptions)
.toString();
}
+ // TODO: mark DhcpOption stable parcelable with @JavaDerive(equals=true, toString=true)
+ // and @JavaOnlyImmutable.
+ private static boolean dhcpOptionEquals(@Nullable DhcpOption obj1, @Nullable DhcpOption obj2) {
+ if (obj1 == obj2) return true;
+ if (obj1 == null || obj2 == null) return false;
+ return obj1.type == obj2.type && Arrays.equals(obj1.value, obj2.value);
+ }
+
+ // TODO: use Objects.equals(List<DhcpOption>, List<DhcpOption>) method instead once
+ // auto-generated equals() method of stable parcelable is supported in mainline-prod.
+ private static boolean dhcpOptionListEquals(@Nullable List<DhcpOption> l1,
+ @Nullable List<DhcpOption> l2) {
+ if (l1 == l2) return true;
+ if (l1 == null || l2 == null) return false;
+ if (l1.size() != l2.size()) return false;
+
+ for (int i = 0; i < l1.size(); i++) {
+ if (!dhcpOptionEquals(l1.get(i), l2.get(i))) return false;
+ }
+ return true;
+ }
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ProvisioningConfiguration)) return false;
@@ -544,7 +583,8 @@
&& Objects.equals(mNetwork, other.mNetwork)
&& Objects.equals(mDisplayName, other.mDisplayName)
&& Objects.equals(mScanResultInfo, other.mScanResultInfo)
- && Objects.equals(mLayer2Info, other.mLayer2Info);
+ && Objects.equals(mLayer2Info, other.mLayer2Info)
+ && dhcpOptionListEquals(mDhcpOptions, other.mDhcpOptions);
}
public boolean isValid() {
diff --git a/common/netlinkclient/src/android/net/netlink/ConntrackMessage.java b/common/netlinkclient/src/android/net/netlink/ConntrackMessage.java
index de8acbe..cc8bb7e 100644
--- a/common/netlinkclient/src/android/net/netlink/ConntrackMessage.java
+++ b/common/netlinkclient/src/android/net/netlink/ConntrackMessage.java
@@ -141,11 +141,11 @@
final String dstIpStr = (dstIp == null) ? "null" : dstIp.getHostAddress();
final String protoStr = NetlinkConstants.stringForProtocol(protoNum);
- return "Tuple{ "
+ return "Tuple{"
+ protoStr + ": "
+ srcIpStr + ":" + Short.toUnsignedInt(srcPort) + " -> "
+ dstIpStr + ":" + Short.toUnsignedInt(dstPort)
- + " }";
+ + "}";
}
}
@@ -538,7 +538,7 @@
@Override
public String toString() {
- return "ConntrackMessage{ "
+ return "ConntrackMessage{"
+ "nlmsghdr{"
+ (mHeader == null ? "" : mHeader.toString(OsConstants.NETLINK_NETFILTER))
+ "}, "
@@ -546,7 +546,7 @@
+ "tuple_orig{" + tupleOrig + "}, "
+ "tuple_reply{" + tupleReply + "}, "
+ "status{" + status + "(" + stringForIpConntrackStatus(status) + ")" + "}, "
- + "timeout_sec{" + Integer.toUnsignedLong(timeoutSec) + "} "
+ + "timeout_sec{" + Integer.toUnsignedLong(timeoutSec) + "}"
+ "}";
}
}
diff --git a/common/networkstackclient/Android.bp b/common/networkstackclient/Android.bp
index fde3103..a1b5dd0 100644
--- a/common/networkstackclient/Android.bp
+++ b/common/networkstackclient/Android.bp
@@ -97,6 +97,7 @@
"src/android/net/ip/IIpClientCallbacks.aidl",
// New AIDL classes should go into android.net.networkstack.aidl so they can be clearly
// identified
+ "src/android/net/networkstack/aidl/dhcp/DhcpOption.aidl",
],
backend: {
java: {
@@ -127,6 +128,7 @@
"7",
"8",
"9",
+ "10",
],
// TODO: have tethering depend on networkstack-client and set visibility to private
visibility: [
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/.hash b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/.hash
new file mode 100644
index 0000000..8125724
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/.hash
@@ -0,0 +1 @@
+4925f4fdbb270e4f35cc5519a15ed8dd8c69a549
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DataStallReportParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DataStallReportParcelable.aidl
new file mode 100644
index 0000000..0f860a5
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DataStallReportParcelable.aidl
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable DataStallReportParcelable {
+ long timestampMillis = 0;
+ int detectionMethod = 1;
+ int tcpPacketFailRate = 2;
+ int tcpMetricsCollectionPeriodMillis = 3;
+ int dnsConsecutiveTimeouts = 4;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DhcpResultsParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DhcpResultsParcelable.aidl
new file mode 100644
index 0000000..4445be7
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/DhcpResultsParcelable.aidl
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable DhcpResultsParcelable {
+ android.net.StaticIpConfiguration baseConfiguration;
+ int leaseDuration;
+ int mtu;
+ String serverAddress;
+ String vendorInfo;
+ @nullable String serverHostName;
+ @nullable String captivePortalApiUrl;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkMonitor.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkMonitor.aidl
new file mode 100644
index 0000000..db9145f
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkMonitor.aidl
@@ -0,0 +1,43 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+/* @hide */
+interface INetworkMonitor {
+ oneway void start();
+ oneway void launchCaptivePortalApp();
+ oneway void notifyCaptivePortalAppFinished(int response);
+ oneway void setAcceptPartialConnectivity();
+ oneway void forceReevaluation(int uid);
+ oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config);
+ oneway void notifyDnsResponse(int returnCode);
+ oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc);
+ oneway void notifyNetworkDisconnected();
+ oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp);
+ oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc);
+ const int NETWORK_TEST_RESULT_VALID = 0;
+ const int NETWORK_TEST_RESULT_INVALID = 1;
+ const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;
+ const int NETWORK_VALIDATION_RESULT_VALID = 1;
+ const int NETWORK_VALIDATION_RESULT_PARTIAL = 2;
+ const int NETWORK_VALIDATION_PROBE_DNS = 4;
+ const int NETWORK_VALIDATION_PROBE_HTTP = 8;
+ const int NETWORK_VALIDATION_PROBE_HTTPS = 16;
+ const int NETWORK_VALIDATION_PROBE_FALLBACK = 32;
+ const int NETWORK_VALIDATION_PROBE_PRIVDNS = 64;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkMonitorCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkMonitorCallbacks.aidl
new file mode 100644
index 0000000..b2685ad
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkMonitorCallbacks.aidl
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+/* @hide */
+interface INetworkMonitorCallbacks {
+ oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor) = 0;
+ oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl) = 1;
+ oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config) = 2;
+ oneway void showProvisioningNotification(String action, String packageName) = 3;
+ oneway void hideProvisioningNotification() = 4;
+ oneway void notifyProbeStatusChanged(int probesCompleted, int probesSucceeded) = 5;
+ oneway void notifyNetworkTestedWithExtras(in android.net.NetworkTestResultParcelable result) = 6;
+ oneway void notifyDataStallSuspected(in android.net.DataStallReportParcelable report) = 7;
+ oneway void notifyCaptivePortalDataChanged(in android.net.CaptivePortalData data) = 8;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkStackConnector.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkStackConnector.aidl
new file mode 100644
index 0000000..396b42a
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkStackConnector.aidl
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+/* @hide */
+interface INetworkStackConnector {
+ oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb);
+ oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb);
+ oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks);
+ oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb);
+ oneway void allowTestUid(int uid, in android.net.INetworkStackStatusCallback cb);
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkStackStatusCallback.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkStackStatusCallback.aidl
new file mode 100644
index 0000000..97c9970
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/INetworkStackStatusCallback.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+/* @hide */
+interface INetworkStackStatusCallback {
+ oneway void onStatusAvailable(int statusCode);
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/InformationElementParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/InformationElementParcelable.aidl
new file mode 100644
index 0000000..77fca83
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/InformationElementParcelable.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable InformationElementParcelable {
+ int id;
+ byte[] payload;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/InitialConfigurationParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/InitialConfigurationParcelable.aidl
new file mode 100644
index 0000000..6137305
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/InitialConfigurationParcelable.aidl
@@ -0,0 +1,26 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable InitialConfigurationParcelable {
+ android.net.LinkAddress[] ipAddresses;
+ android.net.IpPrefix[] directlyConnectedRoutes;
+ String[] dnsServers;
+ String gateway;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/Layer2InformationParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/Layer2InformationParcelable.aidl
new file mode 100644
index 0000000..d3adbb3
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/Layer2InformationParcelable.aidl
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable Layer2InformationParcelable {
+ String l2Key;
+ String cluster;
+ android.net.MacAddress bssid;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/Layer2PacketParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/Layer2PacketParcelable.aidl
new file mode 100644
index 0000000..b45f6da
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/Layer2PacketParcelable.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable Layer2PacketParcelable {
+ android.net.MacAddress dstMacAddress;
+ byte[] payload;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/NattKeepalivePacketDataParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/NattKeepalivePacketDataParcelable.aidl
new file mode 100644
index 0000000..7634ac9
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/NattKeepalivePacketDataParcelable.aidl
@@ -0,0 +1,26 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable NattKeepalivePacketDataParcelable {
+ byte[] srcAddress;
+ int srcPort;
+ byte[] dstAddress;
+ int dstPort;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/NetworkTestResultParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/NetworkTestResultParcelable.aidl
new file mode 100644
index 0000000..1d0bbbe
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/NetworkTestResultParcelable.aidl
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable NetworkTestResultParcelable {
+ long timestampMillis;
+ int result;
+ int probesSucceeded;
+ int probesAttempted;
+ String redirectUrl;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/PrivateDnsConfigParcel.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/PrivateDnsConfigParcel.aidl
new file mode 100644
index 0000000..c6d6361
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/PrivateDnsConfigParcel.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable PrivateDnsConfigParcel {
+ String hostname;
+ String[] ips;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ProvisioningConfigurationParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ProvisioningConfigurationParcelable.aidl
new file mode 100644
index 0000000..171817c
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ProvisioningConfigurationParcelable.aidl
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable ProvisioningConfigurationParcelable {
+ boolean enableIPv4;
+ boolean enableIPv6;
+ boolean usingMultinetworkPolicyTracker;
+ boolean usingIpReachabilityMonitor;
+ int requestedPreDhcpActionMs;
+ android.net.InitialConfigurationParcelable initialConfig;
+ android.net.StaticIpConfiguration staticIpConfig;
+ android.net.apf.ApfCapabilities apfCapabilities;
+ int provisioningTimeoutMs;
+ int ipv6AddrGenMode;
+ android.net.Network network;
+ String displayName;
+ boolean enablePreconnection;
+ @nullable android.net.ScanResultInfoParcelable scanResultInfo;
+ @nullable android.net.Layer2InformationParcelable layer2Info;
+ @nullable List<android.net.networkstack.aidl.dhcp.DhcpOption> options;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ScanResultInfoParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ScanResultInfoParcelable.aidl
new file mode 100644
index 0000000..4646ede
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ScanResultInfoParcelable.aidl
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable ScanResultInfoParcelable {
+ String ssid;
+ String bssid;
+ android.net.InformationElementParcelable[] informationElements;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/TcpKeepalivePacketDataParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/TcpKeepalivePacketDataParcelable.aidl
new file mode 100644
index 0000000..00f15da
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/TcpKeepalivePacketDataParcelable.aidl
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net;
+@JavaDerive(toString=true)
+parcelable TcpKeepalivePacketDataParcelable {
+ byte[] srcAddress;
+ int srcPort;
+ byte[] dstAddress;
+ int dstPort;
+ int seq;
+ int ack;
+ int rcvWnd;
+ int rcvWndScale;
+ int tos;
+ int ttl;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/DhcpLeaseParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/DhcpLeaseParcelable.aidl
new file mode 100644
index 0000000..b0a0f0f
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/DhcpLeaseParcelable.aidl
@@ -0,0 +1,28 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.dhcp;
+@JavaDerive(toString=true)
+parcelable DhcpLeaseParcelable {
+ byte[] clientId;
+ byte[] hwAddr;
+ int netAddr;
+ int prefixLength;
+ long expTime;
+ String hostname;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/DhcpServingParamsParcel.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/DhcpServingParamsParcel.aidl
new file mode 100644
index 0000000..d56ef8e
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/DhcpServingParamsParcel.aidl
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.dhcp;
+@JavaDerive(toString=true)
+parcelable DhcpServingParamsParcel {
+ int serverAddr;
+ int serverAddrPrefixLength;
+ int[] defaultRouters;
+ int[] dnsServers;
+ int[] excludedAddrs;
+ long dhcpLeaseTimeSecs;
+ int linkMtu;
+ boolean metered;
+ int singleClientAddr = 0;
+ boolean changePrefixOnDecline = false;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpEventCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpEventCallbacks.aidl
new file mode 100644
index 0000000..8f3288e
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpEventCallbacks.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.dhcp;
+interface IDhcpEventCallbacks {
+ oneway void onLeasesChanged(in List<android.net.dhcp.DhcpLeaseParcelable> newLeases);
+ oneway void onNewPrefixRequest(in android.net.IpPrefix currentPrefix);
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpServer.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpServer.aidl
new file mode 100644
index 0000000..83cebdf
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpServer.aidl
@@ -0,0 +1,30 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.dhcp;
+/* @hide */
+interface IDhcpServer {
+ oneway void start(in android.net.INetworkStackStatusCallback cb) = 0;
+ oneway void startWithCallbacks(in android.net.INetworkStackStatusCallback statusCb, in android.net.dhcp.IDhcpEventCallbacks eventCb) = 3;
+ oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb) = 1;
+ oneway void stop(in android.net.INetworkStackStatusCallback cb) = 2;
+ const int STATUS_UNKNOWN = 0;
+ const int STATUS_SUCCESS = 1;
+ const int STATUS_INVALID_ARGUMENT = 2;
+ const int STATUS_UNKNOWN_ERROR = 3;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpServerCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpServerCallbacks.aidl
new file mode 100644
index 0000000..35da06c
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/dhcp/IDhcpServerCallbacks.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.dhcp;
+/* @hide */
+interface IDhcpServerCallbacks {
+ oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server);
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ip/IIpClient.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ip/IIpClient.aidl
new file mode 100644
index 0000000..5607b2a
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ip/IIpClient.aidl
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.ip;
+/* @hide */
+interface IIpClient {
+ oneway void completedPreDhcpAction();
+ oneway void confirmConfiguration();
+ oneway void readPacketFilterComplete(in byte[] data);
+ oneway void shutdown();
+ oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req);
+ oneway void stop();
+ oneway void setTcpBufferSizes(in String tcpBufferSizes);
+ oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo);
+ oneway void setMulticastFilter(boolean enabled);
+ oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt);
+ oneway void removeKeepalivePacketFilter(int slot);
+ oneway void setL2KeyAndGroupHint(in String l2Key, in String cluster);
+ oneway void addNattKeepalivePacketFilter(int slot, in android.net.NattKeepalivePacketDataParcelable pkt);
+ oneway void notifyPreconnectionComplete(boolean success);
+ oneway void updateLayer2Information(in android.net.Layer2InformationParcelable info);
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ip/IIpClientCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ip/IIpClientCallbacks.aidl
new file mode 100644
index 0000000..9a84784
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/ip/IIpClientCallbacks.aidl
@@ -0,0 +1,36 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.ip;
+/* @hide */
+interface IIpClientCallbacks {
+ oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient);
+ oneway void onPreDhcpAction();
+ oneway void onPostDhcpAction();
+ oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults);
+ oneway void onProvisioningSuccess(in android.net.LinkProperties newLp);
+ oneway void onProvisioningFailure(in android.net.LinkProperties newLp);
+ oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp);
+ oneway void onReachabilityLost(in String logMsg);
+ oneway void onQuit();
+ oneway void installPacketFilter(in byte[] filter);
+ oneway void startReadPacketFilter();
+ oneway void setFallbackMulticastFilter(boolean enabled);
+ oneway void setNeighborDiscoveryOffload(boolean enable);
+ oneway void onPreconnectionStart(in List<android.net.Layer2PacketParcelable> packets);
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/networkstack/aidl/dhcp/DhcpOption.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/networkstack/aidl/dhcp/DhcpOption.aidl
new file mode 100644
index 0000000..c97212b
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/10/android/net/networkstack/aidl/dhcp/DhcpOption.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.networkstack.aidl.dhcp;
+@JavaDerive(toString=true)
+parcelable DhcpOption {
+ byte type;
+ @nullable byte[] value;
+}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DataStallReportParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DataStallReportParcelable.aidl
index 5fd65f3..0f860a5 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DataStallReportParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DataStallReportParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DhcpResultsParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DhcpResultsParcelable.aidl
index a351016..4445be7 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DhcpResultsParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/DhcpResultsParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitor.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitor.aidl
index 5945819..db9145f 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitor.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitor.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitorCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitorCallbacks.aidl
index b7ddad9..b2685ad 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitorCallbacks.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkMonitorCallbacks.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackConnector.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackConnector.aidl
index 0864886..396b42a 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackConnector.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackConnector.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackStatusCallback.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackStatusCallback.aidl
index ec16def..97c9970 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackStatusCallback.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/INetworkStackStatusCallback.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InformationElementParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InformationElementParcelable.aidl
index ea76763..77fca83 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InformationElementParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InformationElementParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InitialConfigurationParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InitialConfigurationParcelable.aidl
index f8d4aa4..6137305 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InitialConfigurationParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/InitialConfigurationParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2InformationParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2InformationParcelable.aidl
index 30cf4d5..d3adbb3 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2InformationParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2InformationParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2PacketParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2PacketParcelable.aidl
index 30fbbc7..b45f6da 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2PacketParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/Layer2PacketParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NattKeepalivePacketDataParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NattKeepalivePacketDataParcelable.aidl
index 4f2736e..7634ac9 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NattKeepalivePacketDataParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NattKeepalivePacketDataParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NetworkTestResultParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NetworkTestResultParcelable.aidl
index 8dd07bc..1d0bbbe 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NetworkTestResultParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/NetworkTestResultParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/PrivateDnsConfigParcel.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/PrivateDnsConfigParcel.aidl
index 7f124ae..c6d6361 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/PrivateDnsConfigParcel.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/PrivateDnsConfigParcel.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ProvisioningConfigurationParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ProvisioningConfigurationParcelable.aidl
index 4747855..171817c 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ProvisioningConfigurationParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ProvisioningConfigurationParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -33,4 +34,5 @@
boolean enablePreconnection;
@nullable android.net.ScanResultInfoParcelable scanResultInfo;
@nullable android.net.Layer2InformationParcelable layer2Info;
+ @nullable List<android.net.networkstack.aidl.dhcp.DhcpOption> options;
}
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ScanResultInfoParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ScanResultInfoParcelable.aidl
index 5e76ab5..4646ede 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ScanResultInfoParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ScanResultInfoParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/TcpKeepalivePacketDataParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/TcpKeepalivePacketDataParcelable.aidl
index 4401b92..00f15da 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/TcpKeepalivePacketDataParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/TcpKeepalivePacketDataParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpLeaseParcelable.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpLeaseParcelable.aidl
index 3aef40f..b0a0f0f 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpLeaseParcelable.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpLeaseParcelable.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpServingParamsParcel.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpServingParamsParcel.aidl
index d36b11e..d56ef8e 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpServingParamsParcel.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/DhcpServingParamsParcel.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpEventCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpEventCallbacks.aidl
index dfcaf98..8f3288e 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpEventCallbacks.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpEventCallbacks.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServer.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServer.aidl
index ef936cc..83cebdf 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServer.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServer.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServerCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServerCallbacks.aidl
index 63b89ad..35da06c 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServerCallbacks.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/dhcp/IDhcpServerCallbacks.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClient.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClient.aidl
index 9245954..5607b2a 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClient.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClient.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClientCallbacks.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClientCallbacks.aidl
index 9aabb1f..9a84784 100644
--- a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClientCallbacks.aidl
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/ip/IIpClientCallbacks.aidl
@@ -2,13 +2,14 @@
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/networkstack/aidl/dhcp/DhcpOption.aidl b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/networkstack/aidl/dhcp/DhcpOption.aidl
new file mode 100644
index 0000000..c97212b
--- /dev/null
+++ b/common/networkstackclient/aidl_api/networkstack-aidl-interfaces/current/android/net/networkstack/aidl/dhcp/DhcpOption.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.net.networkstack.aidl.dhcp;
+@JavaDerive(toString=true)
+parcelable DhcpOption {
+ byte type;
+ @nullable byte[] value;
+}
diff --git a/common/networkstackclient/src/android/net/ProvisioningConfigurationParcelable.aidl b/common/networkstackclient/src/android/net/ProvisioningConfigurationParcelable.aidl
index 87ef054..0aeebcb 100644
--- a/common/networkstackclient/src/android/net/ProvisioningConfigurationParcelable.aidl
+++ b/common/networkstackclient/src/android/net/ProvisioningConfigurationParcelable.aidl
@@ -23,6 +23,9 @@
import android.net.ScanResultInfoParcelable;
import android.net.StaticIpConfiguration;
import android.net.apf.ApfCapabilities;
+import android.net.networkstack.aidl.dhcp.DhcpOption;
+
+import java.util.List;
@JavaDerive(toString=true)
parcelable ProvisioningConfigurationParcelable {
@@ -41,4 +44,5 @@
boolean enablePreconnection;
@nullable ScanResultInfoParcelable scanResultInfo;
@nullable Layer2InformationParcelable layer2Info;
+ @nullable List<DhcpOption> options;
}
diff --git a/common/networkstackclient/src/android/net/networkstack/aidl/dhcp/DhcpOption.aidl b/common/networkstackclient/src/android/net/networkstack/aidl/dhcp/DhcpOption.aidl
new file mode 100644
index 0000000..f5a3328
--- /dev/null
+++ b/common/networkstackclient/src/android/net/networkstack/aidl/dhcp/DhcpOption.aidl
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2020, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing perNmissions and
+ * limitations under the License.
+ */
+
+package android.net.networkstack.aidl.dhcp;
+
+@JavaDerive(toString=true)
+parcelable DhcpOption {
+ /** The type of the option. */
+ byte type;
+
+ /**
+ * The raw bytes of the DHCP option. When requesting a DHCP option, a null value
+ * indicates that the option should appear in the PRL and not in the options section.
+ */
+ @nullable byte[] value;
+}
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java
index 9059203..5f77128 100644
--- a/src/android/net/dhcp/DhcpClient.java
+++ b/src/android/net/dhcp/DhcpClient.java
@@ -71,6 +71,7 @@
import android.net.metrics.DhcpClientEvent;
import android.net.metrics.DhcpErrorEvent;
import android.net.metrics.IpConnectivityLog;
+import android.net.networkstack.aidl.dhcp.DhcpOption;
import android.net.util.HostnameTransliterator;
import android.net.util.InterfaceParams;
import android.net.util.NetworkStackUtils;
@@ -115,6 +116,7 @@
import java.net.SocketException;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import java.util.List;
import java.util.Random;
/**
@@ -303,6 +305,10 @@
if (isIPv6OnlyPreferredModeEnabled()) {
params.write(DHCP_IPV6_ONLY_PREFERRED);
}
+ // Customized DHCP options to be put in PRL.
+ for (DhcpOption option : mConfiguration.options) {
+ if (option.value == null) params.write(option.type);
+ }
return params.toByteArray();
}
@@ -743,7 +749,8 @@
private boolean sendDiscoverPacket() {
final ByteBuffer packet = DhcpPacket.buildDiscoverPacket(
DhcpPacket.ENCAP_L2, mTransactionId, getSecs(), mHwAddr,
- DO_UNICAST, getRequestedParams(), isDhcpRapidCommitEnabled(), mHostname);
+ DO_UNICAST, getRequestedParams(), isDhcpRapidCommitEnabled(), mHostname,
+ mConfiguration.options);
mMetrics.incrementCountForDiscover();
return transmitPacket(packet, "DHCPDISCOVER", DhcpPacket.ENCAP_L2, INADDR_BROADCAST);
}
@@ -756,9 +763,9 @@
? DhcpPacket.ENCAP_L2 : DhcpPacket.ENCAP_BOOTP;
final ByteBuffer packet = DhcpPacket.buildRequestPacket(
- encap, mTransactionId, getSecs(), clientAddress,
- DO_UNICAST, mHwAddr, requestedAddress,
- serverAddress, getRequestedParams(), mHostname);
+ encap, mTransactionId, getSecs(), clientAddress, DO_UNICAST, mHwAddr,
+ requestedAddress, serverAddress, getRequestedParams(), mHostname,
+ mConfiguration.options);
String serverStr = (serverAddress != null) ? serverAddress.getHostAddress() : null;
String description = "DHCPREQUEST ciaddr=" + clientAddress.getHostAddress() +
" request=" + requestedAddress.getHostAddress() +
@@ -979,10 +986,14 @@
@Nullable
public final String l2Key;
public final boolean isPreconnectionEnabled;
+ @NonNull
+ public final List<DhcpOption> options;
- public Configuration(@Nullable final String l2Key, final boolean isPreconnectionEnabled) {
+ public Configuration(@Nullable final String l2Key, final boolean isPreconnectionEnabled,
+ @NonNull final List<DhcpOption> options) {
this.l2Key = l2Key;
this.isPreconnectionEnabled = isPreconnectionEnabled;
+ this.options = options;
}
}
@@ -1379,7 +1390,8 @@
final Layer2PacketParcelable l2Packet = new Layer2PacketParcelable();
final ByteBuffer packet = DhcpPacket.buildDiscoverPacket(
DhcpPacket.ENCAP_L2, mTransactionId, getSecs(), mHwAddr,
- DO_UNICAST, getRequestedParams(), true /* rapid commit */, mHostname);
+ DO_UNICAST, getRequestedParams(), true /* rapid commit */, mHostname,
+ mConfiguration.options);
l2Packet.dstMacAddress = MacAddress.fromBytes(DhcpPacket.ETHER_BROADCAST);
l2Packet.payload = Arrays.copyOf(packet.array(), packet.limit());
diff --git a/src/android/net/dhcp/DhcpDiscoverPacket.java b/src/android/net/dhcp/DhcpDiscoverPacket.java
index 15c20cf..9c776b9 100644
--- a/src/android/net/dhcp/DhcpDiscoverPacket.java
+++ b/src/android/net/dhcp/DhcpDiscoverPacket.java
@@ -66,6 +66,7 @@
if (mRapidCommit) {
addTlv(buffer, DHCP_RAPID_COMMIT);
}
+ addCustomizedClientTlvs(buffer);
addTlvEnd(buffer);
}
}
diff --git a/src/android/net/dhcp/DhcpPacket.java b/src/android/net/dhcp/DhcpPacket.java
index cf50512..f70f3ec 100644
--- a/src/android/net/dhcp/DhcpPacket.java
+++ b/src/android/net/dhcp/DhcpPacket.java
@@ -22,11 +22,13 @@
import android.net.DhcpResults;
import android.net.LinkAddress;
import android.net.metrics.DhcpErrorEvent;
+import android.net.networkstack.aidl.dhcp.DhcpOption;
import android.os.Build;
import android.os.SystemProperties;
import android.system.OsConstants;
import android.text.TextUtils;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
@@ -185,7 +187,8 @@
* DHCP Optional Type: DHCP Host Name
*/
public static final byte DHCP_HOST_NAME = 12;
- protected String mHostName;
+ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+ public String mHostName;
/**
* DHCP Optional Type: DHCP DOMAIN NAME
@@ -296,7 +299,8 @@
* DHCP Optional Type: Vendor Class Identifier
*/
public static final byte DHCP_VENDOR_CLASS_ID = 60;
- protected String mVendorId;
+ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+ public String mVendorId;
/**
* DHCP Optional Type: DHCP Client Identifier
@@ -305,6 +309,13 @@
protected byte[] mClientId;
/**
+ * DHCP Optional Type: DHCP User Class option
+ */
+ public static final byte DHCP_USER_CLASS = 77;
+ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+ public byte[] mUserClass;
+
+ /**
* DHCP zero-length Optional Type: Rapid Commit. Per RFC4039, both DHCPDISCOVER and DHCPACK
* packet may include this option.
*/
@@ -312,7 +323,7 @@
protected boolean mRapidCommit;
/**
- * DHCP IPv6-Only Preferred Option(draft-ietf-dhc-v6only).
+ * DHCP IPv6-Only Preferred Option(RFC 8925).
* Indicate that a host supports an IPv6-only mode and willing to forgo obtaining an IPv4
* address for V6ONLY_WAIT period if the network provides IPv6 connectivity. V6ONLY_WAIT
* is 32-bit unsigned integer, so the Integer value cannot be used as-is.
@@ -371,6 +382,12 @@
protected String mServerHostName;
/**
+ * The customized DHCP client options to be sent.
+ */
+ @Nullable
+ protected List<DhcpOption> mCustomizedClientOptions;
+
+ /**
* Asks the packet object to create a ByteBuffer serialization of
* the packet for transmission.
*/
@@ -754,9 +771,25 @@
buf.put((byte) 0xFF);
}
- private String getVendorId() {
+ /**
+ * Get the DHCP Vendor Class Identifier.
+ *
+ * By default the vendor Id is "android-dhcp-<version>". The default value will be overwritten
+ * with the customized option value if any.
+ */
+ private static String getVendorId(@Nullable List<DhcpOption> customizedClientOptions) {
if (testOverrideVendorId != null) return testOverrideVendorId;
- return "android-dhcp-" + Build.VERSION.RELEASE;
+
+ String vendorId = "android-dhcp-" + Build.VERSION.RELEASE;
+ if (customizedClientOptions != null) {
+ for (DhcpOption option : customizedClientOptions) {
+ if (option.type == DHCP_VENDOR_CLASS_ID) {
+ vendorId = readAsciiString(option.value, false);
+ break;
+ }
+ }
+ }
+ return vendorId;
}
/**
@@ -779,11 +812,25 @@
*/
protected void addCommonClientTlvs(ByteBuffer buf) {
addTlv(buf, DHCP_MAX_MESSAGE_SIZE, (short) MAX_LENGTH);
- addTlv(buf, DHCP_VENDOR_CLASS_ID, getVendorId());
+ addTlv(buf, DHCP_VENDOR_CLASS_ID, mVendorId);
final String hn = getHostname();
if (!TextUtils.isEmpty(hn)) addTlv(buf, DHCP_HOST_NAME, hn);
}
+ /**
+ * Adds OEM's customized client TLVs, which will be appended before the End Tlv.
+ */
+ protected void addCustomizedClientTlvs(ByteBuffer buf) {
+ if (mCustomizedClientOptions == null) return;
+ for (DhcpOption option : mCustomizedClientOptions) {
+ // A null value means the option should only be put into the PRL.
+ if (option.value == null) continue;
+ // The vendor class ID was already added by addCommonClientTlvs.
+ if (option.type == DHCP_VENDOR_CLASS_ID) continue;
+ addTlv(buf, option.type, option.value);
+ }
+ }
+
protected void addCommonServerTlvs(ByteBuffer buf) {
addTlv(buf, DHCP_LEASE_TIME, mLeaseTime);
if (mLeaseTime != null && mLeaseTime != INFINITE_LEASE) {
@@ -859,9 +906,15 @@
/**
* Reads a string of specified length from the buffer.
*/
- private static String readAsciiString(ByteBuffer buf, int byteCount, boolean nullOk) {
- byte[] bytes = new byte[byteCount];
+ private static String readAsciiString(@NonNull final ByteBuffer buf, int byteCount,
+ boolean nullOk) {
+ final byte[] bytes = new byte[byteCount];
buf.get(bytes);
+ return readAsciiString(bytes, nullOk);
+ }
+
+ private static String readAsciiString(@NonNull final byte[] payload, boolean nullOk) {
+ final byte[] bytes = payload;
int length = bytes.length;
if (!nullOk) {
// Stop at the first null byte. This is because some DHCP options (e.g., the domain
@@ -949,6 +1002,7 @@
Inet4Address requestedIp = null;
String serverHostName;
byte optionOverload = 0;
+ byte[] userClass = null;
// The following are all unsigned integers. Internally we store them as signed integers of
// the same length because that way we're guaranteed that they can't be out of the range of
@@ -1214,6 +1268,11 @@
optionOverload = packet.get();
optionOverload &= OPTION_OVERLOAD_BOTH;
break;
+ case DHCP_USER_CLASS:
+ userClass = new byte[optionLen];
+ packet.get(userClass);
+ expectedLen = optionLen;
+ break;
case DHCP_RAPID_COMMIT:
expectedLen = 0;
rapidCommit = true;
@@ -1315,6 +1374,7 @@
newPacket.mVendorInfo = vendorInfo;
newPacket.mCaptivePortalUrl = captivePortalUrl;
newPacket.mIpv6OnlyWaitTime = ipv6OnlyWaitTime;
+ newPacket.mUserClass = userClass;
if ((optionOverload & OPTION_OVERLOAD_SNAME) == 0) {
newPacket.mServerHostName = serverHostName;
} else {
@@ -1416,20 +1476,33 @@
}
/**
- * Builds a DHCP-DISCOVER packet from the required specified
- * parameters.
+ * Builds a DHCP-DISCOVER packet from the required specified parameters.
*/
public static ByteBuffer buildDiscoverPacket(int encap, int transactionId,
short secs, byte[] clientMac, boolean broadcast, byte[] expectedParams,
- boolean rapidCommit, String hostname) {
+ boolean rapidCommit, String hostname, List<DhcpOption> options) {
DhcpPacket pkt = new DhcpDiscoverPacket(transactionId, secs, INADDR_ANY /* relayIp */,
clientMac, broadcast, INADDR_ANY /* srcIp */, rapidCommit);
pkt.mRequestedParams = expectedParams;
pkt.mHostName = hostname;
+ pkt.mCustomizedClientOptions = options;
+ pkt.mVendorId = getVendorId(options);
return pkt.buildPacket(encap, DHCP_SERVER, DHCP_CLIENT);
}
/**
+ * Builds a DHCP-DISCOVER packet from the required specified parameters.
+ *
+ * TODO: remove this method when automerger to mainline-prod is running.
+ */
+ public static ByteBuffer buildDiscoverPacket(int encap, int transactionId,
+ short secs, byte[] clientMac, boolean broadcast, byte[] expectedParams,
+ boolean rapidCommit, String hostname) {
+ return buildDiscoverPacket(encap, transactionId, secs, clientMac, broadcast,
+ expectedParams, rapidCommit, hostname, new ArrayList<DhcpOption>());
+ }
+
+ /**
* Builds a DHCP-OFFER packet from the required specified parameters.
*/
public static ByteBuffer buildOfferPacket(int encap, int transactionId,
@@ -1538,18 +1611,35 @@
public static ByteBuffer buildRequestPacket(int encap,
int transactionId, short secs, Inet4Address clientIp, boolean broadcast,
byte[] clientMac, Inet4Address requestedIpAddress,
- Inet4Address serverIdentifier, byte[] requestedParams, String hostName) {
+ Inet4Address serverIdentifier, byte[] requestedParams, String hostName,
+ List<DhcpOption> options) {
DhcpPacket pkt = new DhcpRequestPacket(transactionId, secs, clientIp,
INADDR_ANY /* relayIp */, clientMac, broadcast);
pkt.mRequestedIp = requestedIpAddress;
pkt.mServerIdentifier = serverIdentifier;
pkt.mHostName = hostName;
pkt.mRequestedParams = requestedParams;
+ pkt.mCustomizedClientOptions = options;
+ pkt.mVendorId = getVendorId(options);
ByteBuffer result = pkt.buildPacket(encap, DHCP_SERVER, DHCP_CLIENT);
return result;
}
/**
+ * Builds a DHCP-REQUEST packet from the required specified parameters.
+ *
+ * TODO: remove this method when automerger to mainline-prod is running.
+ */
+ public static ByteBuffer buildRequestPacket(int encap,
+ int transactionId, short secs, Inet4Address clientIp, boolean broadcast,
+ byte[] clientMac, Inet4Address requestedIpAddress,
+ Inet4Address serverIdentifier, byte[] requestedParams, String hostName) {
+ return buildRequestPacket(encap, transactionId, secs, clientIp, broadcast, clientMac,
+ requestedIpAddress, serverIdentifier, requestedParams, hostName,
+ new ArrayList<DhcpOption>());
+ }
+
+ /**
* Builds a DHCP-DECLINE packet from the required specified parameters.
*/
public static ByteBuffer buildDeclinePacket(int encap, int transactionId, byte[] clientMac,
diff --git a/src/android/net/dhcp/DhcpRequestPacket.java b/src/android/net/dhcp/DhcpRequestPacket.java
index 0672871..dfd6f0e 100644
--- a/src/android/net/dhcp/DhcpRequestPacket.java
+++ b/src/android/net/dhcp/DhcpRequestPacket.java
@@ -64,6 +64,7 @@
}
addCommonClientTlvs(buffer);
addTlv(buffer, DHCP_PARAMETER_LIST, mRequestedParams);
+ addCustomizedClientTlvs(buffer);
addTlvEnd(buffer);
}
}
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java
index af728e7..a73e997 100644
--- a/src/android/net/ip/IpClient.java
+++ b/src/android/net/ip/IpClient.java
@@ -46,6 +46,7 @@
import android.net.dhcp.DhcpPacket;
import android.net.metrics.IpConnectivityLog;
import android.net.metrics.IpManagerEvent;
+import android.net.networkstack.aidl.dhcp.DhcpOption;
import android.net.shared.InitialConfiguration;
import android.net.shared.ProvisioningConfiguration;
import android.net.shared.ProvisioningConfiguration.ScanResultInfo;
@@ -97,6 +98,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -432,6 +434,17 @@
new byte[] { (byte) 0x00, (byte) 0x17, (byte) 0xf2, (byte) 0x06 }
));
+ // Allows Wi-Fi to pass in DHCP options when particular vendor-specific IEs are present.
+ // Maps each DHCP option code to a list of IEs, any of which will allow that option.
+ private static final Map<Byte, List<byte[]>> DHCP_OPTIONS_ALLOWED = Map.of(
+ (byte) 60, Arrays.asList(
+ // KT OUI: 00:17:C3, type: 17. See b/170928882.
+ new byte[]{ (byte) 0x00, (byte) 0x17, (byte) 0xc3, (byte) 0x17 }),
+ (byte) 77, Arrays.asList(
+ // KT OUI: 00:17:C3, type: 17. See b/170928882.
+ new byte[]{ (byte) 0x00, (byte) 0x17, (byte) 0xc3, (byte) 0x17 })
+ );
+
// Initialize configurable particular SSID set supporting DHCP Roaming feature. See
// b/131797393 for more details.
private static final Set<String> DHCP_ROAMING_SSID_SET = new HashSet<>(
@@ -1396,7 +1409,7 @@
return ssid;
}
- private List<ByteBuffer> getVendorSpecificIEs(@NonNull ScanResultInfo scanResultInfo) {
+ private static List<ByteBuffer> getVendorSpecificIEs(@NonNull ScanResultInfo scanResultInfo) {
ArrayList<ByteBuffer> vendorSpecificPayloadList = new ArrayList<>();
for (InformationElement ie : scanResultInfo.getInformationElements()) {
if (ie.getId() == VENDOR_SPECIFIC_IE_ID) {
@@ -1406,17 +1419,10 @@
return vendorSpecificPayloadList;
}
- private boolean detectUpstreamHotspotFromVendorIe() {
- if (mConfiguration.mScanResultInfo == null) return false;
- final ScanResultInfo scanResultInfo = mConfiguration.mScanResultInfo;
- final String ssid = scanResultInfo.getSsid();
+ private boolean checkIfOuiAndTypeMatched(@NonNull ScanResultInfo scanResultInfo,
+ @NonNull List<byte[]> patternList) {
final List<ByteBuffer> vendorSpecificPayloadList = getVendorSpecificIEs(scanResultInfo);
- if (mConfiguration.mDisplayName == null
- || !removeDoubleQuotes(mConfiguration.mDisplayName).equals(ssid)) {
- return false;
- }
-
for (ByteBuffer payload : vendorSpecificPayloadList) {
byte[] ouiAndType = new byte[4];
try {
@@ -1425,11 +1431,10 @@
Log.e(mTag, "Couldn't parse vendor specific IE, buffer underflow");
return false;
}
- for (byte[] pattern : METERED_IE_PATTERN_LIST) {
+ for (byte[] pattern : patternList) {
if (Arrays.equals(pattern, ouiAndType)) {
if (DBG) {
- Log.d(mTag, "detected upstream hotspot that matches OUI:"
- + HexDump.toHexString(ouiAndType));
+ Log.d(mTag, "match pattern: " + HexDump.toHexString(ouiAndType));
}
return true;
}
@@ -1438,6 +1443,18 @@
return false;
}
+ private boolean detectUpstreamHotspotFromVendorIe() {
+ final ScanResultInfo scanResultInfo = mConfiguration.mScanResultInfo;
+ if (scanResultInfo == null) return false;
+ final String ssid = scanResultInfo.getSsid();
+
+ if (mConfiguration.mDisplayName == null
+ || !removeDoubleQuotes(mConfiguration.mDisplayName).equals(ssid)) {
+ return false;
+ }
+ return checkIfOuiAndTypeMatched(scanResultInfo, METERED_IE_PATTERN_LIST);
+ }
+
private void handleIPv4Success(DhcpResults dhcpResults) {
mDhcpResults = new DhcpResults(dhcpResults);
final LinkProperties newLp = assembleLinkProperties();
@@ -1756,11 +1773,36 @@
return mConfiguration.mEnablePreconnection && mConfiguration.mStaticIpConfig == null;
}
+ /**
+ * Check if the customized DHCP client options passed from Wi-Fi are allowed to be put
+ * in PRL or in the DHCP packet.
+ */
+ private List<DhcpOption> maybeFilterCustomizedDhcpOptions() {
+ final List<DhcpOption> options = new ArrayList<DhcpOption>();
+ if (mConfiguration.mDhcpOptions == null
+ || mConfiguration.mScanResultInfo == null) return options; // empty DhcpOption list
+
+ for (DhcpOption option : mConfiguration.mDhcpOptions) {
+ final List<byte[]> patternList = DHCP_OPTIONS_ALLOWED.get(option.type);
+ // requested option won't be added if no vendor-specific IE oui/type allows this option.
+ if (patternList == null) continue;
+ if (checkIfOuiAndTypeMatched(mConfiguration.mScanResultInfo, patternList)) {
+ options.add(option);
+ }
+ }
+ Collections.sort(options, (o1, o2) ->
+ Integer.compare(Byte.toUnsignedInt(o1.type), Byte.toUnsignedInt(o2.type)));
+ return options;
+ }
+
private void startDhcpClient() {
// Start DHCPv4.
mDhcpClient = mDependencies.makeDhcpClient(mContext, IpClient.this, mInterfaceParams,
mDependencies.getDhcpClientDependencies(mIpMemoryStore, mIpProvisioningMetrics));
+ // Check if the vendor-specific IE oui/type matches and filters the customized DHCP options.
+ final List<DhcpOption> options = maybeFilterCustomizedDhcpOptions();
+
// If preconnection is enabled, there is no need to ask Wi-Fi to disable powersaving
// during DHCP, because the DHCP handshake will happen during association. In order to
// ensure that future renews still do the DHCP action (if configured),
@@ -1768,7 +1810,7 @@
// messages.
if (!isUsingPreconnection()) mDhcpClient.registerForPreDhcpNotification();
mDhcpClient.sendMessage(DhcpClient.CMD_START_DHCP, new DhcpClient.Configuration(mL2Key,
- isUsingPreconnection()));
+ isUsingPreconnection(), options));
}
class ClearingIpAddressesState extends State {
diff --git a/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java b/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java
index fe78d59..158898a 100644
--- a/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java
+++ b/tests/integration/src/android/net/ip/IpClientIntegrationTestCommon.java
@@ -116,6 +116,7 @@
import android.net.ipmemorystore.Status;
import android.net.netlink.StructNdOptPref64;
import android.net.networkstack.TestNetworkStackServiceClient;
+import android.net.networkstack.aidl.dhcp.DhcpOption;
import android.net.shared.Layer2Information;
import android.net.shared.ProvisioningConfiguration;
import android.net.shared.ProvisioningConfiguration.ScanResultInfo;
@@ -337,6 +338,14 @@
private static final String TEST_DHCP_ROAM_L2KEY = "roaming_l2key";
private static final String TEST_DHCP_ROAM_CLUSTER = "roaming_cluster";
private static final byte[] TEST_AP_OUI = new byte[] { 0x00, 0x1A, 0x11 };
+ private static final byte[] TEST_OEM_OUI = new byte[] {(byte) 0x00, (byte) 0x17, (byte) 0xc3};
+ private static final String TEST_OEM_VENDOR_ID = "vendor-class-identifier";
+ private static final byte[] TEST_OEM_USER_CLASS_INFO = new byte[] {
+ // Instance of User Class: [0]
+ (byte) 0x03, /* UC_Len_0 */ (byte) 0x11, (byte) 0x22, (byte) 0x33,
+ // Instance of User Class: [1]
+ (byte) 0x03, /* UC_Len_1 */ (byte) 0x44, (byte) 0x55, (byte) 0x66,
+ };
protected class Dependencies extends IpClient.Dependencies {
private boolean mIsDhcpLeaseCacheEnabled;
@@ -2190,6 +2199,12 @@
return new ScanResultInfo(ssid, bssid, Collections.singletonList(ie));
}
+ private ScanResultInfo makeScanResultInfo(final int id, final byte[] oui, final byte type) {
+ byte[] data = new byte[10];
+ new Random().nextBytes(data);
+ return makeScanResultInfo(id, TEST_DEFAULT_SSID, TEST_DEFAULT_BSSID, oui, type, data);
+ }
+
private ScanResultInfo makeScanResultInfo(final String ssid, final String bssid) {
byte[] data = new byte[10];
new Random().nextBytes(data);
@@ -2689,4 +2704,138 @@
// extra fds), since it's likely that any leak would at least leak one FD per loop.
assertEquals("Fd leak after " + iterations + " iterations: ", before, after);
}
+
+ // TODO: delete when DhcpOption is @JavaOnlyImmutable.
+ private static DhcpOption makeDhcpOption(final byte type, final byte[] value) {
+ final DhcpOption opt = new DhcpOption();
+ opt.type = type;
+ opt.value = value;
+ return opt;
+ }
+
+ private static final List<DhcpOption> TEST_OEM_DHCP_OPTIONS = Arrays.asList(
+ // DHCP_USER_CLASS
+ makeDhcpOption((byte) 77, TEST_OEM_USER_CLASS_INFO),
+ // DHCP_VENDOR_CLASS_ID
+ makeDhcpOption((byte) 60, TEST_OEM_VENDOR_ID.getBytes())
+ );
+
+ private DhcpPacket doCustomizedDhcpOptionsTest(final List<DhcpOption> options,
+ final ScanResultInfo info) throws Exception {
+ ProvisioningConfiguration.Builder prov = new ProvisioningConfiguration.Builder()
+ .withoutIpReachabilityMonitor()
+ .withLayer2Information(new Layer2Information(TEST_L2KEY, TEST_CLUSTER,
+ MacAddress.fromString(TEST_DEFAULT_BSSID)))
+ .withScanResultInfo(info)
+ .withDhcpOptions(options)
+ .withoutIPv6();
+
+ setDhcpFeatures(false /* isDhcpLeaseCacheEnabled */, false /* isRapidCommitEnabled */,
+ false /* isDhcpIpConflictDetectEnabled */);
+
+ startIpClientProvisioning(prov.build());
+ verify(mCb, timeout(TEST_TIMEOUT_MS)).setFallbackMulticastFilter(false);
+ verify(mCb, never()).onProvisioningFailure(any());
+
+ return getNextDhcpPacket();
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions() throws Exception {
+ final ScanResultInfo info = makeScanResultInfo(0xdd /* vendor-specificIE */, TEST_OEM_OUI,
+ (byte) 0x17 /* vendor-specific IE type */);
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(TEST_OEM_DHCP_OPTIONS, info);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, TEST_OEM_VENDOR_ID);
+ assertArrayEquals(packet.mUserClass, TEST_OEM_USER_CLASS_INFO);
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions_nullDhcpOptions() throws Exception {
+ final ScanResultInfo info = makeScanResultInfo(0xdd /* vendor-specificIE */, TEST_OEM_OUI,
+ (byte) 0x17 /* vendor-specific IE type */);
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(null /* options */, info);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, new String("android-dhcp-" + Build.VERSION.RELEASE));
+ assertNull(packet.mUserClass);
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions_nullScanResultInfo() throws Exception {
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(TEST_OEM_DHCP_OPTIONS,
+ null /* scanResultInfo */);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, new String("android-dhcp-" + Build.VERSION.RELEASE));
+ assertNull(packet.mUserClass);
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions_disallowedOui() throws Exception {
+ final ScanResultInfo info = makeScanResultInfo(0xdd /* vendor-specificIE */,
+ new byte[]{ 0x00, 0x11, 0x22} /* oui */, (byte) 0x17 /* vendor-specific IE type */);
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(TEST_OEM_DHCP_OPTIONS, info);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, new String("android-dhcp-" + Build.VERSION.RELEASE));
+ assertNull(packet.mUserClass);
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions_invalidIeId() throws Exception {
+ final ScanResultInfo info = makeScanResultInfo(0xde /* vendor-specificIE */, TEST_OEM_OUI,
+ (byte) 0x17 /* vendor-specific IE type */);
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(TEST_OEM_DHCP_OPTIONS, info);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, new String("android-dhcp-" + Build.VERSION.RELEASE));
+ assertNull(packet.mUserClass);
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions_invalidVendorSpecificType() throws Exception {
+ final ScanResultInfo info = makeScanResultInfo(0xdd /* vendor-specificIE */, TEST_OEM_OUI,
+ (byte) 0x10 /* vendor-specific IE type */);
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(TEST_OEM_DHCP_OPTIONS, info);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, new String("android-dhcp-" + Build.VERSION.RELEASE));
+ assertNull(packet.mUserClass);
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions_disallowedOption() throws Exception {
+ final List<DhcpOption> options = Arrays.asList(
+ makeDhcpOption((byte) 60, TEST_OEM_VENDOR_ID.getBytes()),
+ makeDhcpOption((byte) 77, TEST_OEM_USER_CLASS_INFO),
+ // DHCP_HOST_NAME
+ makeDhcpOption((byte) 12, new String("Pixel 3 XL").getBytes()));
+ final ScanResultInfo info = makeScanResultInfo(0xdd /* vendor-specificIE */, TEST_OEM_OUI,
+ (byte) 0x17 /* vendor-specific IE type */);
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(options, info);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, TEST_OEM_VENDOR_ID);
+ assertArrayEquals(packet.mUserClass, TEST_OEM_USER_CLASS_INFO);
+ assertNull(packet.mHostName);
+ }
+
+ @Test
+ public void testCustomizedDhcpOptions_disallowedParamRequestOption() throws Exception {
+ final List<DhcpOption> options = Arrays.asList(
+ makeDhcpOption((byte) 60, TEST_OEM_VENDOR_ID.getBytes()),
+ makeDhcpOption((byte) 77, TEST_OEM_USER_CLASS_INFO),
+ // NTP_SERVER
+ makeDhcpOption((byte) 42, null));
+ final ScanResultInfo info = makeScanResultInfo(0xdd /* vendor-specificIE */, TEST_OEM_OUI,
+ (byte) 0x17 /* vendor-specific IE type */);
+ final DhcpPacket packet = doCustomizedDhcpOptionsTest(options, info);
+
+ assertTrue(packet instanceof DhcpDiscoverPacket);
+ assertEquals(packet.mVendorId, TEST_OEM_VENDOR_ID);
+ assertArrayEquals(packet.mUserClass, TEST_OEM_USER_CLASS_INFO);
+ assertFalse(packet.hasRequestedParam((byte) 42 /* NTP_SERVER */));
+ }
}
diff --git a/tests/unit/src/android/net/dhcp/DhcpPacketTest.java b/tests/unit/src/android/net/dhcp/DhcpPacketTest.java
index d668691..d0c49d3 100644
--- a/tests/unit/src/android/net/dhcp/DhcpPacketTest.java
+++ b/tests/unit/src/android/net/dhcp/DhcpPacketTest.java
@@ -1120,7 +1120,7 @@
ByteBuffer packet = DhcpPacket.buildDiscoverPacket(
DhcpPacket.ENCAP_L2, transactionId, secs, hwaddr,
false /* do unicast */, DhcpClient.DEFAULT_REQUESTED_PARAMS,
- false /* rapid commit */, testHostname);
+ false /* rapid commit */, testHostname, null /* customized DHCP options */);
final byte[] headers = new byte[] {
// Ethernet header.
diff --git a/tests/unit/src/android/net/ip/ConntrackMonitorTest.java b/tests/unit/src/android/net/ip/ConntrackMonitorTest.java
index 9f9be91..6e9078e 100644
--- a/tests/unit/src/android/net/ip/ConntrackMonitorTest.java
+++ b/tests/unit/src/android/net/ip/ConntrackMonitorTest.java
@@ -257,24 +257,18 @@
assertNotEquals(e, timeoutSecNotEqual);
}
- // TODO: consider moving to a common file for sharing.
- private static void assertContains(String actualValue, String expectedSubstring) {
- if (actualValue.contains(expectedSubstring)) return;
- fail("\"" + actualValue + "\" does not contain \"" + expectedSubstring + "\"");
- }
-
@Test
public void testToString() {
final ConntrackEvent event = makeTestConntrackEvent(IPCTNL_MSG_CT_NEW,
0x198 /* status */, 120 /* timeoutSec */);
- final String s = event.toString();
-
- // Verify the converted string of msg_type, tuple_orig, tuple_reply, status and timeout.
- assertContains(s, "IPCTNL_MSG_CT_NEW");
- assertContains(s, "IPPROTO_TCP: 192.168.80.12:62449 -> 140.112.8.116:443");
- assertContains(s, "IPPROTO_TCP: 140.112.8.116:443 -> 100.81.179.1:62449");
- assertContains(s, "IPS_CONFIRMED|IPS_SRC_NAT|IPS_SRC_NAT_DONE|IPS_DST_NAT_DONE");
- assertContains(s, "timeout_sec{120}");
+ final String expected = ""
+ + "ConntrackEvent{"
+ + "msg_type{IPCTNL_MSG_CT_NEW}, "
+ + "tuple_orig{Tuple{IPPROTO_TCP: 192.168.80.12:62449 -> 140.112.8.116:443}}, "
+ + "tuple_reply{Tuple{IPPROTO_TCP: 140.112.8.116:443 -> 100.81.179.1:62449}}, "
+ + "status{408(IPS_CONFIRMED|IPS_SRC_NAT|IPS_SRC_NAT_DONE|IPS_DST_NAT_DONE)}, "
+ + "timeout_sec{120}}";
+ assertEquals(expected, event.toString());
}
public static final String CT_V4DELETE_TCP_HEX =
diff --git a/tests/unit/src/android/net/netlink/ConntrackMessageTest.java b/tests/unit/src/android/net/netlink/ConntrackMessageTest.java
index d86cf10..2e8d184 100644
--- a/tests/unit/src/android/net/netlink/ConntrackMessageTest.java
+++ b/tests/unit/src/android/net/netlink/ConntrackMessageTest.java
@@ -24,7 +24,6 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import android.system.OsConstants;
@@ -404,12 +403,6 @@
assertEquals(4, messageCount);
}
- // TODO: consider moving to a common file for sharing.
- private static void assertContains(String actualValue, String expectedSubstring) {
- if (actualValue.contains(expectedSubstring)) return;
- fail("\"" + actualValue + "\" does not contain \"" + expectedSubstring + "\"");
- }
-
@Test
public void testToString() {
assumeTrue(USING_LE);
@@ -420,16 +413,21 @@
assertNotNull(msg);
assertTrue(msg instanceof ConntrackMessage);
final ConntrackMessage conntrackMessage = (ConntrackMessage) msg;
- final String s = conntrackMessage.toString();
- // Verify the converted string of nlmsg_type, tuple_orig, tuple_reply, status and timeout.
- // Note that the "nlmsg_flags" string doesn't verify because the flags which have the same
- // value is not distinguishable now. See StructNlMsgHdr#stringForNlMsgFlags.
- // TODO: verify the converted string of nlmsg_flags once it has fixed.
- assertContains(s, "IPCTNL_MSG_CT_NEW");
- assertContains(s, "IPPROTO_TCP: 192.168.80.12:62449 -> 140.112.8.116:443");
- assertContains(s, "IPPROTO_TCP: 140.112.8.116:443 -> 100.81.179.1:62449");
- assertContains(s, "IPS_CONFIRMED|IPS_SRC_NAT|IPS_SRC_NAT_DONE|IPS_DST_NAT_DONE");
- assertContains(s, "timeout_sec{120}");
+ // Bug: "nlmsg_flags{1536(NLM_F_MATCH))" is not correct because StructNlMsgHdr
+ // #stringForNlMsgFlags can't convert all flags (ex: NLM_F_CREATE) and can't distinguish
+ // the flags which have the same value (ex: NLM_F_MATCH <0x200> and NLM_F_EXCL <0x200>).
+ // The flags output string should be "NLM_F_CREATE|NLM_F_EXCL" in this case.
+ // TODO: correct the flag converted string once #stringForNlMsgFlags does.
+ final String expected = ""
+ + "ConntrackMessage{"
+ + "nlmsghdr{StructNlMsgHdr{ nlmsg_len{140}, nlmsg_type{256(IPCTNL_MSG_CT_NEW)}, "
+ + "nlmsg_flags{1536(NLM_F_MATCH))}, nlmsg_seq{0}, nlmsg_pid{0} }}, "
+ + "nfgenmsg{NfGenMsg{ nfgen_family{AF_INET}, version{0}, res_id{4660} }}, "
+ + "tuple_orig{Tuple{IPPROTO_TCP: 192.168.80.12:62449 -> 140.112.8.116:443}}, "
+ + "tuple_reply{Tuple{IPPROTO_TCP: 140.112.8.116:443 -> 100.81.179.1:62449}}, "
+ + "status{408(IPS_CONFIRMED|IPS_SRC_NAT|IPS_SRC_NAT_DONE|IPS_DST_NAT_DONE)}, "
+ + "timeout_sec{120}}";
+ assertEquals(expected, conntrackMessage.toString());
}
}
diff --git a/tests/unit/src/android/net/shared/ProvisioningConfigurationTest.java b/tests/unit/src/android/net/shared/ProvisioningConfigurationTest.java
index 7d36fee..436b81a 100644
--- a/tests/unit/src/android/net/shared/ProvisioningConfigurationTest.java
+++ b/tests/unit/src/android/net/shared/ProvisioningConfigurationTest.java
@@ -30,6 +30,7 @@
import android.net.ProvisioningConfigurationParcelable;
import android.net.StaticIpConfiguration;
import android.net.apf.ApfCapabilities;
+import android.net.networkstack.aidl.dhcp.DhcpOption;
import android.net.shared.ProvisioningConfiguration.ScanResultInfo;
import androidx.test.filters.SmallTest;
@@ -40,7 +41,9 @@
import org.junit.runner.RunWith;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import java.util.function.Consumer;
/**
@@ -63,6 +66,16 @@
Collections.singletonList(ie));
}
+ private List<DhcpOption> makeCustomizedDhcpOptions(byte type, final byte[] value) {
+ final DhcpOption option = new DhcpOption();
+ option.type = type;
+ option.value = value;
+
+ final List<DhcpOption> options = new ArrayList<DhcpOption>();
+ options.add(option);
+ return options;
+ }
+
@Before
public void setUp() {
mConfig = new ProvisioningConfiguration();
@@ -87,8 +100,10 @@
mConfig.mScanResultInfo = makeScanResultInfo("ssid");
mConfig.mLayer2Info = new Layer2Information("some l2key", "some cluster",
MacAddress.fromString("00:01:02:03:04:05"));
+ mConfig.mDhcpOptions = makeCustomizedDhcpOptions((byte) 60,
+ new String("android-dhcp-11").getBytes());
// Any added field must be included in equals() to be tested properly
- assertFieldCountEquals(15, ProvisioningConfiguration.class);
+ assertFieldCountEquals(16, ProvisioningConfiguration.class);
}
@Test
@@ -127,6 +142,12 @@
}
@Test
+ public void testParcelUnparcel_NullCustomizedDhcpOptions() {
+ mConfig.mDhcpOptions = null;
+ doParcelUnparcelTest();
+ }
+
+ @Test
public void testParcelUnparcel_WithPreDhcpConnection() {
mConfig.mEnablePreconnection = true;
doParcelUnparcelTest();
@@ -171,7 +192,13 @@
assertNotEqualsAfterChange(c -> c.mLayer2Info = new Layer2Information("some l2key",
"some cluster", MacAddress.fromString("01:02:03:04:05:06")));
assertNotEqualsAfterChange(c -> c.mLayer2Info = null);
- assertFieldCountEquals(15, ProvisioningConfiguration.class);
+ assertNotEqualsAfterChange(c -> c.mDhcpOptions = new ArrayList<DhcpOption>());
+ assertNotEqualsAfterChange(c -> c.mDhcpOptions = null);
+ assertNotEqualsAfterChange(c -> c.mDhcpOptions = makeCustomizedDhcpOptions((byte) 60,
+ new String("vendor-class-identifier").getBytes()));
+ assertNotEqualsAfterChange(c -> c.mDhcpOptions = makeCustomizedDhcpOptions((byte) 77,
+ new String("vendor-class-identifier").getBytes()));
+ assertFieldCountEquals(16, ProvisioningConfiguration.class);
}
private void assertNotEqualsAfterChange(Consumer<ProvisioningConfiguration> mutator) {
@@ -194,7 +221,9 @@
+ " informationElements: [android.net.InformationElementParcelable{id: 221,"
+ " payload: [0, 23, -14, 6, 1, 1, 3, 1, 0, 0]}]}, layer2Info:"
+ " android.net.Layer2InformationParcelable{l2Key: some l2key,"
- + " cluster: some cluster, bssid: %s}}";
+ + " cluster: some cluster, bssid: %s},"
+ + " options: [android.net.networkstack.aidl.dhcp.DhcpOption{type: 60,"
+ + " value: [97, 110, 100, 114, 111, 105, 100, 45, 100, 104, 99, 112, 45, 49, 49]}]}";
@Test
public void testParcelableToString() {