1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
Index: tun.c
===================================================================
--- tun.c (revision 2713)
+++ tun.c (revision 2715)
@@ -1220,26 +1220,44 @@
{
if (tt)
{
-#ifdef CONFIG_FEATURE_IPROUTE
if (tt->type != DEV_TYPE_NULL && tt->did_ifconfig)
{
char command_line[256];
struct gc_arena gc = gc_new ();
+#ifdef CONFIG_FEATURE_IPROUTE
+ if (is_tun_p2p (tt))
+ {
+ openvpn_snprintf (command_line, sizeof (command_line),
+ "%s addr del dev %s local %s peer %s",
+ iproute_path,
+ tt->actual_name,
+ print_in_addr_t (tt->local, 0, &gc),
+ print_in_addr_t (tt->remote_netmask, 0, &gc)
+ );
+ }
+ else
+ {
+ openvpn_snprintf (command_line, sizeof (command_line),
+ "%s addr del dev %s %s/%d",
+ iproute_path,
+ tt->actual_name,
+ print_in_addr_t (tt->local, 0, &gc),
+ count_netmask_bits(print_in_addr_t (tt->remote_netmask, 0, &gc))
+ );
+ }
+#else
openvpn_snprintf (command_line, sizeof (command_line),
- "%s addr del dev %s local %s peer %s",
- iproute_path,
- tt->actual_name,
- print_in_addr_t (tt->local, 0, &gc),
- print_in_addr_t (tt->remote_netmask, 0, &gc)
- );
+ IFCONFIG_PATH "%s addr 0.0.0.0",
+ tt->actual_name
+ );
+#endif
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);
}
|