netd: Route MTU

- Route may include optional MTU parameter
- Change route is added so routes don't need to be deleted then re-added
- Add/Del/Change functions to pass route info as parcel

Bug: 142892223
Test: new unit tests
Change-Id: Idc32ecb0520b1f4136b3fe0e3f7b6800fb3005a6
diff --git a/server/NetworkController.h b/server/NetworkController.h
index e0abde0..ff49c02 100644
--- a/server/NetworkController.h
+++ b/server/NetworkController.h
@@ -88,6 +88,9 @@
     static constexpr int LOCAL_NET_ID = INetd::LOCAL_NET_ID;
     static constexpr int DUMMY_NET_ID = 51;
 
+    // Route mode for modify route
+    enum RouteOperation { ROUTE_ADD, ROUTE_UPDATE, ROUTE_REMOVE };
+
     NetworkController();
 
     unsigned getDefaultNetwork() const;
@@ -122,7 +125,9 @@
     // Routes are added to tables determined by the interface, so only |interface| is actually used.
     // |netId| is given only to sanity check that the interface has the correct netId.
     [[nodiscard]] int addRoute(unsigned netId, const char* interface, const char* destination,
-                               const char* nexthop, bool legacy, uid_t uid);
+                               const char* nexthop, bool legacy, uid_t uid, int mtu);
+    [[nodiscard]] int updateRoute(unsigned netId, const char* interface, const char* destination,
+                                  const char* nexthop, bool legacy, uid_t uid, int mtu);
     [[nodiscard]] int removeRoute(unsigned netId, const char* interface, const char* destination,
                                   const char* nexthop, bool legacy, uid_t uid);
 
@@ -158,7 +163,8 @@
     [[nodiscard]] int createPhysicalNetworkLocked(unsigned netId, Permission permission);
 
     [[nodiscard]] int modifyRoute(unsigned netId, const char* interface, const char* destination,
-                                  const char* nexthop, bool add, bool legacy, uid_t uid);
+                                  const char* nexthop, RouteOperation op, bool legacy, uid_t uid,
+                                  int mtu);
     [[nodiscard]] int modifyFallthroughLocked(unsigned vpnNetId, bool add);
     void updateTcpSocketMonitorPolling();