type safety for bool optional am: f2466ef4bb

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775543

Change-Id: I4a6949ad279d752cb52daea336d3d0cc4e1bceac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
index 323b0d6..eea7dd2 100644
--- a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
+++ b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
@@ -364,7 +364,7 @@
         .gid = (prog_gid),                                                               \
         .min_kver = (min_kv),                                                            \
         .max_kver = (max_kv),                                                            \
-        .optional = (opt),                                                               \
+        .optional = (opt).optional,                                                      \
         .bpfloader_min_ver = (min_loader),                                               \
         .bpfloader_max_ver = (max_loader),                                               \
         .selinux_context = (selinux),                                                    \
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 0a7439c..615a570 100644
--- a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
+++ b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
@@ -120,9 +120,10 @@
 #define PRIVATE ((struct shared_bool){ .shared = false })
 #define SHARED ((struct shared_bool){ .shared = true })
 
-// constants for passing in to 'bool optional' (for programs)
-static const bool MANDATORY = false;
-static const bool OPTIONAL = true;
+// for programs:
+struct optional_bool { bool optional; };
+#define MANDATORY ((struct optional_bool){ .optional = false })
+#define OPTIONAL ((struct optional_bool){ .optional = true })
 
 // constants for passing in to ignore_on_eng / ignore_on_user / ignore_on_userdebug
 static const bool LOAD_ON_ENG = false;