diff --git a/main.cpp b/main.cpp index 2728443..ca38256 100644 --- a/main.cpp +++ b/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" diff --git a/tun.cpp b/tun.cpp index 09ce3a1..b15c1e2 100644 --- a/tun.cpp +++ b/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");