Merge "Add XFRM_MIGRATE support and freeze INetd v12."
diff --git a/staticlibs/native/bpf_headers/BpfRingbufTest.cpp b/staticlibs/native/bpf_headers/BpfRingbufTest.cpp
index 0785d62..4a45a93 100644
--- a/staticlibs/native/bpf_headers/BpfRingbufTest.cpp
+++ b/staticlibs/native/bpf_headers/BpfRingbufTest.cpp
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "BpfSyscallWrappers.h"
 #include "bpf/BpfUtils.h"
 
 namespace android {
diff --git a/staticlibs/native/bpf_headers/include/bpf/BpfMap.h b/staticlibs/native/bpf_headers/include/bpf/BpfMap.h
index 47256fa..51e6d16 100644
--- a/staticlibs/native/bpf_headers/include/bpf/BpfMap.h
+++ b/staticlibs/native/bpf_headers/include/bpf/BpfMap.h
@@ -22,6 +22,8 @@
 #include <android-base/stringprintf.h>
 #include <android-base/unique_fd.h>
 #include <utils/Log.h>
+
+#include "BpfSyscallWrappers.h"
 #include "bpf/BpfUtils.h"
 
 namespace android {
diff --git a/staticlibs/native/bpf_headers/include/bpf/BpfUtils.h b/staticlibs/native/bpf_headers/include/bpf/BpfUtils.h
index dc4fb17..28d4b8b 100644
--- a/staticlibs/native/bpf_headers/include/bpf/BpfUtils.h
+++ b/staticlibs/native/bpf_headers/include/bpf/BpfUtils.h
@@ -25,21 +25,12 @@
 #include <sys/socket.h>
 #include <sys/utsname.h>
 
-#include <string>
-
 #include <android-base/unique_fd.h>
 #include <log/log.h>
 
-#include "BpfSyscallWrappers.h"
-
-// The buffer size for the buffer that records program loading logs, needs to be large enough for
-// the largest kernel program.
-
 namespace android {
 namespace bpf {
 
-constexpr const int OVERFLOW_COUNTERSET = 2;
-
 constexpr const uint64_t NONEXISTENT_COOKIE = 0;
 
 static inline uint64_t getSocketCookie(int sockFd) {
diff --git a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
index 02caf07..f17cf3a 100644
--- a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
+++ b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
@@ -174,7 +174,14 @@
     char pin_subdir[BPF_PIN_SUBDIR_CHAR_ARRAY_SIZE];
 
     bool shared;  // use empty string as 'file' component of pin path - allows cross .o map sharing
-    char pad0[3];  // manually pad up to 4 byte alignment, may be used for extensions in the future
+
+    // The following 3 ignore_on_* fields were added in version 0.32 (U). These are ignored in
+    // older bpfloader versions, and zero in programs compiled before 0.32.
+    bool ignore_on_eng:1;
+    bool ignore_on_user:1;
+    bool ignore_on_userdebug:1;
+
+    char pad0[2];  // manually pad up to 4 byte alignment, may be used for extensions in the future
 
     unsigned int uid;   // uid_t
 };
@@ -196,7 +203,14 @@
     unsigned int max_kver;
 
     bool optional;  // program section (ie. function) may fail to load, continue onto next func.
-    char pad0[3];
+
+    // The following 3 ignore_on_* fields were added in version 0.32 (U). These are ignored in
+    // older bpfloader versions, and zero in programs compiled before 0.32.
+    bool ignore_on_eng:1;
+    bool ignore_on_user:1;
+    bool ignore_on_userdebug:1;
+
+    char pad0[2];  // manually pad up to 4 byte alignment, may be used for extensions in the future
 
     // The following fields were added in version 0.1
     unsigned int bpfloader_min_ver;  // if missing, defaults to 0, ie. v0.0
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt b/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
index 92c83b7..124d134 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
+++ b/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
@@ -46,7 +46,7 @@
     private val backingRecord: ArrayTrackRecord<CallbackEntry>
 ) : NetworkCallback() {
     public constructor() : this(ArrayTrackRecord())
-    protected constructor(src: RecorderCallback?): this(src?.backingRecord ?: ArrayTrackRecord())
+    protected constructor(src: RecorderCallback?) : this(src?.backingRecord ?: ArrayTrackRecord())
 
     private val TAG = this::class.simpleName
 
@@ -177,7 +177,7 @@
     constructor(
         timeoutMs: Long = DEFAULT_TIMEOUT,
         noCallbackTimeoutMs: Long = DEFAULT_NO_CALLBACK_TIMEOUT
-    ): this(null, timeoutMs, noCallbackTimeoutMs)
+    ) : this(null, timeoutMs, noCallbackTimeoutMs)
 
     fun createLinkedCopy() = TestableNetworkCallback(
             this, defaultTimeoutMs, defaultNoCallbackTimeoutMs)
@@ -373,6 +373,7 @@
         assertNotNull(it, "Callback ${T::class} not received within ${timeoutMs}ms")
     } as T
 
+    @JvmOverloads
     fun <T : CallbackEntry> eventuallyExpect(
         type: KClass<T>,
         timeoutMs: Long = defaultTimeoutMs,
@@ -422,6 +423,7 @@
     // @param validated the expected value of the VALIDATED capability in the
     //        onCapabilitiesChanged callback.
     // @param tmt how long to wait for the callbacks.
+    @JvmOverloads
     fun expectAvailableCallbacks(
         net: Network,
         suspended: Boolean = false,