ClatdController - add mutex annotations

This effectively makes ClatdController single threaded.
Which makes things nice and simple.

Test: atest libbpf_android_test libnetdbpf_test netd_integration_test netd_unit_test netdutils_test resolv_integration_test resolv_unit_test
Bug: 65674744
Change-Id: I352761b6c44c17f9ea0897ea821a826f642659d5
diff --git a/server/ClatdController.cpp b/server/ClatdController.cpp
index 3ef2fe1..7c16404 100644
--- a/server/ClatdController.cpp
+++ b/server/ClatdController.cpp
@@ -71,7 +71,9 @@
 ClatdController::~ClatdController() {
 }
 
-void ClatdController::Init(void) {
+void ClatdController::init(void) {
+    std::lock_guard guard(mutex);
+
     // TODO: should refactor into separate function for testability
     if (bpf::getBpfSupportLevel() == bpf::BpfLevel::NONE) {
         ALOGI("Pre-4.9 kernel or pre-P api shipping level - disabling clat ebpf.");
@@ -403,6 +405,7 @@
 
 int ClatdController::startClatd(const std::string& interface, const std::string& nat64Prefix,
                                 std::string* v6Str) {
+    std::lock_guard guard(mutex);
     ClatdTracker* existing = getClatdTracker(interface);
     if (existing != nullptr) {
         ALOGE("clatd pid=%d already started on %s", existing->pid, interface.c_str());
@@ -447,6 +450,7 @@
 }
 
 int ClatdController::stopClatd(const std::string& interface) {
+    std::lock_guard guard(mutex);
     ClatdTracker* tracker = getClatdTracker(interface);
 
     if (tracker == nullptr) {