diff options
Diffstat (limited to '')
-rw-r--r-- | tun.c | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -795,19 +795,42 @@ do_ifconfig (struct tuntap *tt, ifconfig_remote_netmask, tun_mtu ); - else - openvpn_snprintf (command_line, sizeof (command_line), + else { + if (tt->topology == TOP_SUBNET) + openvpn_snprintf (command_line, sizeof (command_line), + IFCONFIG_PATH " %s %s %s netmask %s mtu %d up", + actual, + ifconfig_local, + ifconfig_local, + ifconfig_remote_netmask, + tun_mtu + ); + else + openvpn_snprintf (command_line, sizeof (command_line), IFCONFIG_PATH " %s %s netmask %s mtu %d up", actual, ifconfig_local, ifconfig_remote_netmask, tun_mtu ); + } msg (M_INFO, "%s", command_line); system_check (command_line, es, S_FATAL, "FreeBSD ifconfig failed"); tt->did_ifconfig = true; + /* Add a network route for the local tun interface */ + if (!tun && tt->topology == TOP_SUBNET) + { + struct route r; + CLEAR (r); + r.defined = true; + r.network = tt->local & tt->remote_netmask; + r.netmask = tt->remote_netmask; + r.gateway = tt->local; + add_route (&r, tt, 0, es); + } + #elif defined (WIN32) { /* |