Add output mark to XfrmController

Adds the ability for XfrmController to set output marks, to allow
support for VTIs. This change uses the underlying networkId field
(renamed from underlyingNetwork), for which the System Server currently
passes the netid of the underlying Network.

Bug: 72392543
Test: All tests (CTS + unit tests) passing
Change-Id: I76fe052ecf0fc193f07713a2ea31a4ad58fc9ff9
diff --git a/server/XfrmController.h b/server/XfrmController.h
index 9869c67..2dc8406 100644
--- a/server/XfrmController.h
+++ b/server/XfrmController.h
@@ -131,7 +131,7 @@
 
     netdutils::Status ipSecAddSecurityAssociation(
         int32_t transformId, int32_t mode, const std::string& sourceAddress,
-        const std::string& destinationAddress, int64_t underlyingNetworkHandle, int32_t spi,
+        const std::string& destinationAddress, int32_t underlyingNetId, int32_t spi,
         int32_t markValue, int32_t markMask, const std::string& authAlgo,
         const std::vector<uint8_t>& authKey, int32_t authTruncBits, const std::string& cryptAlgo,
         const std::vector<uint8_t>& cryptKey, int32_t cryptTruncBits, const std::string& aeadAlgo,
@@ -220,6 +220,13 @@
         xfrm_mark mark;
     };
 
+    // Container for the content of an XFRMA_OUTPUT_MARK netlink attribute.
+    // Exposed for testing
+    struct nlattr_xfrm_output_mark {
+        nlattr hdr;
+        __u32 outputMark;
+    };
+
 private:
 /*
  * Below is a redefinition of the xfrm_usersa_info struct that is part
@@ -298,6 +305,8 @@
     static int fillUserPolicyId(const XfrmSaInfo& record, XfrmDirection direction,
                                 xfrm_userpolicy_id* policy_id);
     static int fillNlAttrXfrmMark(const XfrmId& record, nlattr_xfrm_mark* mark);
+    static int fillNlAttrXfrmOutputMark(const __u32 output_mark_value,
+                                        nlattr_xfrm_output_mark* output_mark);
 
     static netdutils::Status allocateSpi(const XfrmSaInfo& record, uint32_t minSpi, uint32_t maxSpi,
                                          uint32_t* outSpi, const XfrmSocket& sock);