Disable piscsi_bridge creation

This commit is contained in:
Daniel Markstedt 2024-02-17 20:06:00 +09:00
parent 806fa25609
commit 6b867346bc
2 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ using namespace network_util;
// const string CTapDriver::BRIDGE_NAME = "piscsi_bridge"; // 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& 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__ #ifndef __linux__
return "if_nametoindex: Linux is required"; return "if_nametoindex: Linux is required";
#else #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()); memcpy(m_MacAddr.data(), ifr.ifr_hwaddr.sa_data, m_MacAddr.size());
close(ip_fd); close(ip_fd);
close(br_socket_fd); // close(br_socket_fd);
spdlog::info("Tap device " + string(ifr.ifr_name) + " created"); spdlog::info("Tap device " + string(ifr.ifr_name) + " created");
@ -254,9 +254,9 @@ pair<string, string> CTapDriver::ExtractAddressAndMask(const string& s)
return { address, netmask }; return { address, netmask };
} }
#if 0
string CTapDriver::SetUpEth0(int socket_fd, const string& bridge_interface) string CTapDriver::SetUpEth0(int socket_fd, const string& bridge_interface)
{ {
#if 0
#ifdef __linux__ #ifdef __linux__
spdlog::trace(">brctl addbr " + BRIDGE_NAME); 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()) { if (const string error = br_setif(socket_fd, BRIDGE_NAME, bridge_interface, true); !error.empty()) {
return error; return error;
} }
#endif
#endif #endif
return ""; return "";
} }
#endif
#if 0
string CTapDriver::SetUpNonEth0(int socket_fd, int ip_fd, const string& s) string CTapDriver::SetUpNonEth0(int socket_fd, int ip_fd, const string& s)
{ {
#ifdef __linux__ #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"; return "Error extracting inet address and netmask";
} }
#if 0
spdlog::trace(">brctl addbr " + BRIDGE_NAME); spdlog::trace(">brctl addbr " + BRIDGE_NAME);
if (ioctl(socket_fd, SIOCBRADDBR, BRIDGE_NAME.c_str()) < 0) { if (ioctl(socket_fd, SIOCBRADDBR, BRIDGE_NAME.c_str()) < 0) {
return "Can't ioctl SIOCBRADDBR"; return "Can't ioctl SIOCBRADDBR";
} }
#endif
ifreq ifr_a; ifreq ifr_a;
ifr_a.ifr_addr.sa_family = AF_INET; 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 ""; return "";
} }
#endif
string CTapDriver::IpLink(bool enable) const string CTapDriver::IpLink(bool enable) const
{ {

View File

@ -56,7 +56,7 @@ public:
private: private:
static string SetUpEth0(int, const string&); //static string SetUpEth0(int, const string&);
static string SetUpNonEth0(int, int, const string&); static string SetUpNonEth0(int, int, const string&);
static pair<string, string> ExtractAddressAndMask(const string&); static pair<string, string> ExtractAddressAndMask(const string&);