summaryrefslogtreecommitdiffstats
path: root/tun.c
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2011-05-23 12:16:49 +0200
committerDavid Sommerseth <davids@redhat.com>2011-05-23 12:16:49 +0200
commit8a606673bdd4251c0db876e36e92751907816bb4 (patch)
tree14f5b0c124021af1e21c8ee04de20f1fc6bf8f35 /tun.c
parent555fc5e34a9b1aca4bfa435023fe1aa336557ec7 (diff)
parentb55e49bd69484fdd440098f9485de159251e1cce (diff)
downloadopenvpn-8a606673bdd4251c0db876e36e92751907816bb4.tar.gz
openvpn-8a606673bdd4251c0db876e36e92751907816bb4.tar.xz
openvpn-8a606673bdd4251c0db876e36e92751907816bb4.zip
Merge remote-tracking branch 'cron2/feat_ipv6_payload_2.3'
Conflicts: options.c - version string for IPv6 payload changed Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'tun.c')
-rw-r--r--tun.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/tun.c b/tun.c
index 5a41cdf..895409a 100644
--- a/tun.c
+++ b/tun.c
@@ -591,6 +591,18 @@ void add_route_connected_v6_net(struct tuntap * tt,
r6.gateway = tt->local_ipv6;
add_route_ipv6 (&r6, tt, 0, es);
}
+
+void delete_route_connected_v6_net(struct tuntap * tt,
+ const struct env_set *es)
+{
+ struct route_ipv6 r6;
+
+ r6.defined = true;
+ r6.network = tt->local_ipv6;
+ r6.netbits = tt->netbits_ipv6;
+ r6.gateway = tt->local_ipv6;
+ delete_route_ipv6 (&r6, tt, 0, es);
+}
#endif
@@ -1167,9 +1179,9 @@ do_ifconfig (struct tuntap *tt,
if (!strcmp (actual, "NULL"))
msg (M_FATAL, "Error: When using --tun-ipv6, if you have more than one TAP-Win32 adapter, you must also specify --dev-node");
- /* example: netsh interface ipv6 add address MyTap 2001:608:8003::d */
+ /* example: netsh interface ipv6 set address MyTap 2001:608:8003::d store=active */
argv_printf (&argv,
- "%s%sc interface ipv6 add address %s %s",
+ "%s%sc interface ipv6 set address %s %s store=active",
get_win_sys_path(),
NETSH_PATH_SUFFIX,
actual,
@@ -1649,7 +1661,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
* http://www.whiteboard.ne.jp/~admin2/tuntap/
* has IPv6 support
*/
- memset(&ifr, 0x0, sizeof(ifr));
+ CLEAR(ifr);
if (tt->type == DEV_TYPE_NULL)
{
@@ -4853,9 +4865,23 @@ close_tun (struct tuntap *tt)
{
if ( tt->ipv6 && tt->did_ifconfig_ipv6_setup )
{
+ struct argv argv;
+ argv_init (&argv);
+
+ /* remove route pointing to interface */
+ delete_route_connected_v6_net(tt, NULL);
+
/* netsh interface ipv6 delete address \"%s\" %s */
const char * ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0, &gc);
- msg( M_WARN, "TODO: remove IPv6 address %s", ifconfig_ipv6_local );
+ argv_printf (&argv,
+ "%s%sc interface ipv6 delete address %s %s",
+ get_win_sys_path(),
+ NETSH_PATH_SUFFIX,
+ tt->actual_name,
+ ifconfig_ipv6_local );
+
+ netsh_command (&argv, 1);
+ argv_reset (&argv);
}
#if 1
if (tt->ipapi_context_defined)