diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-01-26 04:43:13 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-01-26 04:43:13 +0000 |
commit | 4fa5b758340447c0bc24a54793bce3a0bb149648 (patch) | |
tree | 0f5f8afffd708f74174a5bab713dedf701cfe85f /tun.c | |
parent | Added a few extra files that exist in the svn repo (diff) | |
download | openvpn-4fa5b758340447c0bc24a54793bce3a0bb149648.tar.xz |
Fixup null interface on close, don't use ip addr flush
(Alon Bar-Lev).
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2683 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'tun.c')
-rw-r--r-- | tun.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -1221,17 +1221,24 @@ close_tun (struct tuntap *tt) if (tt) { #ifdef CONFIG_FEATURE_IPROUTE - char command_line[256]; - /* - * Flush IP configuration for the device - */ - openvpn_snprintf (command_line, sizeof (command_line), - "%s addr flush dev %s", + if (tt->type != DEV_TYPE_NULL && tt->did_ifconfig) + { + char command_line[256]; + struct gc_arena gc = gc_new (); + + openvpn_snprintf (command_line, sizeof (command_line), + "%s addr del dev %s local %s peer %s", iproute_path, - tt->actual_name + tt->actual_name, + print_in_addr_t (tt->local, 0, &gc), + print_in_addr_t (tt->remote_netmask, 0, &gc) ); - msg (M_INFO, "%s", command_line); - system_check (command_line, NULL, S_FATAL, "Linux ip flush failed"); + + msg (M_INFO, "%s", command_line); + system_check (command_line, NULL, S_FATAL, "Linux ip addr del failed"); + + gc_free (&gc); + } #endif close_tun_generic (tt); free (tt); |