mirror of
https://github.com/norohind/hans.git
synced 2025-04-15 06:00:33 +03:00
fixed ip assignment, v0.3.1
This commit is contained in:
parent
085e76e34b
commit
05064b327e
2
main.cpp
2
main.cpp
@ -34,7 +34,7 @@
|
||||
void usage()
|
||||
{
|
||||
printf(
|
||||
"Hans - IP over ICMP version 0.3\n\n"
|
||||
"Hans - IP over ICMP version 0.3.1\n\n"
|
||||
"RUN AS SERVER\n"
|
||||
" hans -s network [-fvr] [-p password] [-u unprivileged_user] [-d tun_device] [-m reference_mtu]\n\n"
|
||||
"RUN AS CLIENT\n"
|
||||
|
4
tun.cpp
4
tun.cpp
@ -67,7 +67,11 @@ void Tun::setIp(uint32_t ip, uint32_t destIp, bool includeSubnet)
|
||||
string ips = Utility::formatIp(ip);
|
||||
string destIps = Utility::formatIp(destIp);
|
||||
|
||||
#ifdef LINUX
|
||||
snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str());
|
||||
#else
|
||||
snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
|
||||
#endif
|
||||
|
||||
if (system(cmdline) != 0)
|
||||
syslog(LOG_ERR, "could not set tun device ip address");
|
||||
|
Loading…
x
Reference in New Issue
Block a user