Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Mar 14, 2024
1 parent d997b76 commit 429b5d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cpp/devices/tap_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ string TapDriver::CreateBridge(int bridge_fd, int ip_fd)

string TapDriver::SetAddressAndNetMask(int fd, const string &interface) const
{
const auto [address, netmask] = ExtractAddressAndMask(inet);
const auto [address, netmask] = ExtractAddressAndMask();
if (address.empty() || netmask.empty()) {
return "Error extracting inet address and netmask";
}
Expand Down Expand Up @@ -227,11 +227,11 @@ string TapDriver::SetAddressAndNetMask(int fd, const string &interface) const
return "";
}

pair<string, string> TapDriver::ExtractAddressAndMask(const string &addr)
pair<string, string> TapDriver::ExtractAddressAndMask() const
{
string address = addr;
string address = inet;
string netmask = DEFAULT_NETMASK;
if (const auto &components = Split(addr, '/', 2); components.size() == 2) {
if (const auto &components = Split(inet, '/', 2); components.size() == 2) {
address = components[0];

int m;
Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/tap_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TapDriver
static string IpLink(int, const string&, bool);
static string BrSetIf(int fd, const string&, const string&, bool);
string CreateBridge(int, int);
static pair<string, string> ExtractAddressAndMask(const string&);
pair<string, string> ExtractAddressAndMask() const;
string SetAddressAndNetMask(int, const string&) const;
string EnablePromiscuousMode() const;

Expand Down

0 comments on commit 429b5d6

Please sign in to comment.