git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2683 e7ae566f-a301-0410-adde-c780ea21d3b5
james authored on 2008/01/26 13:43:13... | ... |
@@ -1221,17 +1221,24 @@ close_tun (struct tuntap *tt) |
1221 | 1221 |
if (tt) |
1222 | 1222 |
{ |
1223 | 1223 |
#ifdef CONFIG_FEATURE_IPROUTE |
1224 |
- char command_line[256]; |
|
1225 |
- /* |
|
1226 |
- * Flush IP configuration for the device |
|
1227 |
- */ |
|
1228 |
- openvpn_snprintf (command_line, sizeof (command_line), |
|
1229 |
- "%s addr flush dev %s", |
|
1224 |
+ if (tt->type != DEV_TYPE_NULL && tt->did_ifconfig) |
|
1225 |
+ { |
|
1226 |
+ char command_line[256]; |
|
1227 |
+ struct gc_arena gc = gc_new (); |
|
1228 |
+ |
|
1229 |
+ openvpn_snprintf (command_line, sizeof (command_line), |
|
1230 |
+ "%s addr del dev %s local %s peer %s", |
|
1230 | 1231 |
iproute_path, |
1231 |
- tt->actual_name |
|
1232 |
+ tt->actual_name, |
|
1233 |
+ print_in_addr_t (tt->local, 0, &gc), |
|
1234 |
+ print_in_addr_t (tt->remote_netmask, 0, &gc) |
|
1232 | 1235 |
); |
1233 |
- msg (M_INFO, "%s", command_line); |
|
1234 |
- system_check (command_line, NULL, S_FATAL, "Linux ip flush failed"); |
|
1236 |
+ |
|
1237 |
+ msg (M_INFO, "%s", command_line); |
|
1238 |
+ system_check (command_line, NULL, S_FATAL, "Linux ip addr del failed"); |
|
1239 |
+ |
|
1240 |
+ gc_free (&gc); |
|
1241 |
+ } |
|
1235 | 1242 |
#endif |
1236 | 1243 |
close_tun_generic (tt); |
1237 | 1244 |
free (tt); |