summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lorenzo Colitti <lorenzo@google.com> 2017-09-05 11:15:37 +0900
committer Lorenzo Colitti <lorenzo@google.com> 2018-01-16 02:08:09 +0900
commite4fc6322a4f89c97843ad82950fb6757050b0072 (patch)
tree1be2abf240d4a9e8e5dc8a7d066999dcf8175b88
parent639fe64ce0d6daac8698d8ed2db5d526f3a3b015 (diff)
Change the netId to nethandle mapping.
Being able to update this handle is necessary to ensure that system-only OTAs do not break vendor code that relies on nethandles. Bug: 63052780 Test: walleye builds, boots, networking works Test: MultinetworkApiTest CTS tests passes Change-Id: I049a4ad2610ca68b8f56377b63be7e5e8ce76039
-rw-r--r--core/java/android/net/Network.java6
-rw-r--r--native/android/net.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java
index 903b602b42f8..3683d3450b41 100644
--- a/core/java/android/net/Network.java
+++ b/core/java/android/net/Network.java
@@ -356,13 +356,13 @@ public class Network implements Parcelable {
// Multiple Provisioning Domains API recommendations, as made by the
// IETF mif working group.
//
- // The HANDLE_MAGIC value MUST be kept in sync with the corresponding
+ // The handleMagic value MUST be kept in sync with the corresponding
// value in the native/android/net.c NDK implementation.
if (netId == 0) {
return 0L; // make this zero condition obvious for debugging
}
- final long HANDLE_MAGIC = 0xfacade;
- return (((long) netId) << 32) | HANDLE_MAGIC;
+ final long handleMagic = 0xcafed00dL;
+ return (((long) netId) << 32) | handleMagic;
}
// implement the Parcelable interface
diff --git a/native/android/net.c b/native/android/net.c
index de4b90cc1956..60296a7bd00c 100644
--- a/native/android/net.c
+++ b/native/android/net.c
@@ -27,7 +27,7 @@ static int getnetidfromhandle(net_handle_t handle, unsigned *netid) {
static const uint32_t k32BitMask = 0xffffffff;
// This value MUST be kept in sync with the corresponding value in
// the android.net.Network#getNetworkHandle() implementation.
- static const uint32_t kHandleMagic = 0xfacade;
+ static const uint32_t kHandleMagic = 0xcafed00d;
// Check for minimum acceptable version of the API in the low bits.
if (handle != NETWORK_UNSPECIFIED &&