Remove unused code

This commit is contained in:
Friedrich Schöller 2017-05-12 21:18:38 +02:00
parent 6ae989fdee
commit 7991b11a15
4 changed files with 4 additions and 11 deletions

View File

@ -137,7 +137,7 @@ bool Client::handleEchoData(const TunnelHeader &header, int dataLength, uint32_t
clientIp = ip;
desiredIp = ip;
tun->setIp(ip, (ip & 0xffffff00) + 1, false);
tun->setIp(ip, (ip & 0xffffff00) + 1);
}
state = STATE_ESTABLISHED;

View File

@ -39,7 +39,7 @@ Server::Server(int tunnelMtu, const char *deviceName, const char *passphrase, ui
this->pollTimeout = pollTimeout;
this->latestAssignedIpOffset = FIRST_ASSIGNED_IP_OFFSET - 1;
tun->setIp(this->network + 1, this->network + 2, true);
tun->setIp(this->network + 1, this->network + 2);
dropPrivileges();
}

View File

@ -88,7 +88,7 @@ Tun::~Tun()
tun_close(fd, device);
}
void Tun::setIp(uint32_t ip, uint32_t destIp, bool includeSubnet)
void Tun::setIp(uint32_t ip, uint32_t destIp)
{
char cmdline[512];
string ips = Utility::formatIp(ip);
@ -109,13 +109,6 @@ void Tun::setIp(uint32_t ip, uint32_t destIp, bool includeSubnet)
snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
if (system(cmdline) != 0)
syslog(LOG_ERR, "could not set tun device ip address");
if (includeSubnet)
{
snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str());
if (system(cmdline) != 0)
syslog(LOG_ERR, "could not add route");
}
#endif
}

View File

@ -38,7 +38,7 @@ public:
void write(const char *buffer, int length);
void setIp(uint32_t ip, uint32_t destIp, bool includeSubnet);
void setIp(uint32_t ip, uint32_t destIp);
protected:
char device[VTUN_DEV_LEN];