Disable Net NS feature for Tizen
authorKunhoon Baik <knhoon.baik@samsung.com>
Mon, 23 Aug 2021 07:53:47 +0000 (16:53 +0900)
committerKunhoon Baik <knhoon.baik@samsung.com>
Mon, 23 Aug 2021 07:53:47 +0000 (16:53 +0900)
Tizen does not support libnl3 net namespace officially because libnl3 version is 3.2.22.

At this moment, malort project does not require network virtualization.
Thus, at this moment, it is ok to disable Tizen.

In the future, when libnl3 is upgraded to over 3.2.24, net namespace feature will be enabled.

net.cc

diff --git a/net.cc b/net.cc
index 3f93ae40d17859c700ef277499860891cf5fc258..eeb8b51fdf839b68d89f88e6a6e5b63e12957682 100644 (file)
--- a/net.cc
+++ b/net.cc
@@ -110,6 +110,7 @@ static bool cloneIface(
 }
 #endif
 
+#ifndef TIZEN
 static bool moveToNs(
     const std::string& iface, struct nl_sock* sk, struct nl_cache* link_cache, pid_t pid) {
        LOG_D("Moving interface '%s' into netns=%d", iface.c_str(), (int)pid);
@@ -126,9 +127,7 @@ static bool moveToNs(
                return false;
        }
 
-#ifndef TIZEN
        rtnl_link_set_ns_pid(new_link, pid);
-#endif
 
        int err = rtnl_link_change(sk, orig_link, new_link, RTM_SETLINK);
        if (err < 0) {
@@ -143,6 +142,13 @@ static bool moveToNs(
        rtnl_link_put(orig_link);
        return true;
 }
+#else
+static bool moveToNs(
+    const std::string& iface, struct nl_sock* sk, struct nl_cache* link_cache, pid_t pid) {
+       return true;
+}
+#endif
+
 
 bool initNsFromParent(nsjconf_t* nsjconf, int pid) {
        if (!nsjconf->clone_newnet) {