start netd earlier

In this change we're moving the asynchronous netd startup ahead of
the async statd and *synchronous* update_verifier.

This is desirable as we want a netd failure (which could
happen due to some mainline incompatibility wrt. bpf
or mainline shipped shared libs: resolver or netd updatable)
to be considered a signal for a bad boot.

It's still asynchronous though, so it's not ideal.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib3e252f085f569864feddaf20ac80858a3bb969d
diff --git a/init/README.md b/init/README.md
index de57208..560c528 100644
--- a/init/README.md
+++ b/init/README.md
@@ -501,9 +501,10 @@
       reformatted here if it couldn't mount in first-stage init.
    6. `post-fs-data-checkpointed` - Triggered when vold has completed committing a checkpoint
       after an OTA update. Not triggered if checkpointing is not needed or supported.
-   7. `zygote-start` - Start the zygote.
-   8. `early-boot` - After zygote has started.
-   9. `boot` - After `early-boot` actions have completed.
+   7. `bpf-progs-loaded` - Starts things that want to start ASAP but need eBPF (incl. netd)
+   8. `zygote-start` - Start the zygote.
+   9. `early-boot` - After zygote has started.
+  10. `boot` - After `early-boot` actions have completed.
 
 Commands
 --------
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 63e3d06..41b9451 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -560,6 +560,7 @@
 
     # Should be before netd, but after apex, properties and logging is available.
     trigger load_bpf_programs
+    trigger bpf-progs-loaded
 
     # Now we can start zygote.
     trigger zygote-start
@@ -1109,6 +1110,9 @@
 on property:vold.checkpoint_committed=1
     trigger post-fs-data-checkpointed
 
+on bpf-progs-loaded
+    start netd
+
 # It is recommended to put unnecessary data/ initialization from post-fs-data
 # to start-zygote in device's init.rc to unblock zygote start.
 on zygote-start
@@ -1116,7 +1120,6 @@
     # A/B update verifier that marks a successful boot.
     exec_start update_verifier
     start statsd
-    start netd
     start zygote
     start zygote_secondary