mirror of
https://github.com/norohind/hans.git
synced 2025-04-15 06:00:33 +03:00
Remove unused code
This commit is contained in:
parent
6ae989fdee
commit
7991b11a15
@ -137,7 +137,7 @@ bool Client::handleEchoData(const TunnelHeader &header, int dataLength, uint32_t
|
|||||||
|
|
||||||
clientIp = ip;
|
clientIp = ip;
|
||||||
desiredIp = ip;
|
desiredIp = ip;
|
||||||
tun->setIp(ip, (ip & 0xffffff00) + 1, false);
|
tun->setIp(ip, (ip & 0xffffff00) + 1);
|
||||||
}
|
}
|
||||||
state = STATE_ESTABLISHED;
|
state = STATE_ESTABLISHED;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ Server::Server(int tunnelMtu, const char *deviceName, const char *passphrase, ui
|
|||||||
this->pollTimeout = pollTimeout;
|
this->pollTimeout = pollTimeout;
|
||||||
this->latestAssignedIpOffset = FIRST_ASSIGNED_IP_OFFSET - 1;
|
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();
|
dropPrivileges();
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ Tun::~Tun()
|
|||||||
tun_close(fd, device);
|
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];
|
char cmdline[512];
|
||||||
string ips = Utility::formatIp(ip);
|
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());
|
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)
|
if (system(cmdline) != 0)
|
||||||
syslog(LOG_ERR, "could not set tun device ip address");
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
|
|
||||||
void write(const char *buffer, int length);
|
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:
|
protected:
|
||||||
char device[VTUN_DEV_LEN];
|
char device[VTUN_DEV_LEN];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user