summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-04-05 06:28:19 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-04-05 06:28:19 +0000
commitc1c27fe32ae25edbca3bd2217ff00097e7de5f38 (patch)
tree3acf92df6520c69f9dccdd5a1ccd23fc66615ffa
parent07d19ba76c2d1e10d042948b3fb7aa359b194280 (diff)
downloadopenvpn-c1c27fe32ae25edbca3bd2217ff00097e7de5f38.tar.gz
openvpn-c1c27fe32ae25edbca3bd2217ff00097e7de5f38.tar.xz
openvpn-c1c27fe32ae25edbca3bd2217ff00097e7de5f38.zip
"topology subnet" fix for FreeBSD (Benoit Bourdin).
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@986 e7ae566f-a301-0410-adde-c780ea21d3b5
-rw-r--r--tun.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/tun.c b/tun.c
index 07f6ea4..26d7cef 100644
--- a/tun.c
+++ b/tun.c
@@ -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)
{
/*