diff --git a/cpp/devices/ctapdriver.cpp b/cpp/devices/ctapdriver.cpp index 2ecb171d..85f0faf1 100644 --- a/cpp/devices/ctapdriver.cpp +++ b/cpp/devices/ctapdriver.cpp @@ -32,7 +32,7 @@ using namespace network_util; // const string CTapDriver::BRIDGE_NAME = "piscsi_bridge"; //static string br_setif(int br_socket_fd, const string& bridgename, const string& ifname, bool add) { -static string br_setif(int br_socket_fd, const string& ifname, bool add) { +static string br_setif(const string& ifname) { #ifndef __linux__ return "if_nametoindex: Linux is required"; #else @@ -195,7 +195,7 @@ bool CTapDriver::Init(const param_map& const_params) memcpy(m_MacAddr.data(), ifr.ifr_hwaddr.sa_data, m_MacAddr.size()); close(ip_fd); - close(br_socket_fd); + // close(br_socket_fd); spdlog::info("Tap device " + string(ifr.ifr_name) + " created"); @@ -254,9 +254,9 @@ pair CTapDriver::ExtractAddressAndMask(const string& s) return { address, netmask }; } +#if 0 string CTapDriver::SetUpEth0(int socket_fd, const string& bridge_interface) { -#if 0 #ifdef __linux__ spdlog::trace(">brctl addbr " + BRIDGE_NAME); @@ -269,12 +269,13 @@ string CTapDriver::SetUpEth0(int socket_fd, const string& bridge_interface) if (const string error = br_setif(socket_fd, BRIDGE_NAME, bridge_interface, true); !error.empty()) { return error; } -#endif #endif return ""; } +#endif +#if 0 string CTapDriver::SetUpNonEth0(int socket_fd, int ip_fd, const string& s) { #ifdef __linux__ @@ -283,13 +284,11 @@ string CTapDriver::SetUpNonEth0(int socket_fd, int ip_fd, const string& s) return "Error extracting inet address and netmask"; } -#if 0 spdlog::trace(">brctl addbr " + BRIDGE_NAME); if (ioctl(socket_fd, SIOCBRADDBR, BRIDGE_NAME.c_str()) < 0) { return "Can't ioctl SIOCBRADDBR"; } -#endif ifreq ifr_a; ifr_a.ifr_addr.sa_family = AF_INET; @@ -316,6 +315,7 @@ string CTapDriver::SetUpNonEth0(int socket_fd, int ip_fd, const string& s) return ""; } +#endif string CTapDriver::IpLink(bool enable) const { diff --git a/cpp/devices/ctapdriver.h b/cpp/devices/ctapdriver.h index 1e60f4ee..9fac8e66 100644 --- a/cpp/devices/ctapdriver.h +++ b/cpp/devices/ctapdriver.h @@ -56,7 +56,7 @@ public: private: - static string SetUpEth0(int, const string&); + //static string SetUpEth0(int, const string&); static string SetUpNonEth0(int, int, const string&); static pair ExtractAddressAndMask(const string&);