Fix the build problem with bpf project

Add the necessary Android.bp file and fix the compile error for the new
bpf project.

Fix the run time restart false alarm in bpf loader.

Bug: 112334572

Test: device boot and dumpsys netd show eBPF object okay, runtime
      restart netd and no bpfloader error showed in logcat.
Change-Id: Iae193bda45e50b7d22479086d6403e3c4fb185c4
diff --git a/bpfloader/Android.bp b/bpfloader/Android.bp
index fe52bcf..48189e0 100644
--- a/bpfloader/Android.bp
+++ b/bpfloader/Android.bp
@@ -20,7 +20,7 @@
 cc_binary {
     name: "bpfloader",
 
-    defaults: ["netd_defaults"],
+    defaults: ["bpf_defaults"],
     cflags: [
         "-Wall",
         "-Werror",
@@ -35,6 +35,7 @@
         "libbpf",
         "libbase",
         "liblog",
+        "libnetdbpf",
         "libnetdutils",
     ],
     srcs: [
@@ -54,5 +55,5 @@
         "-Wall",
         "-Werror",
     ],
-    include_dirs: ["system/netd/libbpf/include"],
+    include_dirs: ["system/netd/libnetdbpf/include"],
 }
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index c7b1332..3d3d4dd 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -44,7 +44,7 @@
 #include <netdutils/Misc.h>
 #include <netdutils/Slice.h>
 #include "bpf/BpfUtils.h"
-#include "bpf/bpf_shared.h"
+#include "netdbpf/bpf_shared.h"
 
 using android::base::unique_fd;
 using android::netdutils::Slice;
diff --git a/bpfloader/bpf_kern.h b/bpfloader/bpf_kern.h
index e56033d..25edbd4 100644
--- a/bpfloader/bpf_kern.h
+++ b/bpfloader/bpf_kern.h
@@ -16,16 +16,7 @@
 
 /*
  * This h file together with bpf_kern.c is used for compiling the eBPF kernel
- * program. To generate the bpf_kern.o file manually, use the clang prebuilt in
- * this android tree to compile the files with --target=bpf options. For
- * example, in system/netd/ directory, execute the following command:
- * $: ANDROID_BASE_DIRECTORY/prebuilts/clang/host/linux-x86/clang-4691093/bin/clang  \
- *    -I ANDROID_BASE_DIRECTORY/bionic/libc/kernel/uapi/ \
- *    -I ANDROID_BASE_DIRECTORY/system/netd/bpfloader/ \
- *    -I ANDROID_BASE_DIRECTORY/bionic/libc/kernel/android/uapi/ \
- *    -I ANDROID_BASE_DIRECTORY/bionic/libc/include \
- *    -I ANDROID_BASE_DIRECTORY/system/netd/libbpf/include  \
- *    --target=bpf -O2 -c bpfloader/bpf_kern.c -o bpfloader/bpf_kern.o
+ * program.
  */
 
 #include <linux/bpf.h>
@@ -37,7 +28,7 @@
 #include <linux/ipv6.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include "bpf/bpf_shared.h"
+#include "netdbpf/bpf_shared.h"
 
 #define ELF_SEC(NAME) __attribute__((section(NAME), used))