This option was useful when IPv6 tun support was non standard and was an
internal/user specified flag that tracked the Ipv6 capability of the tun
device.
All supported OS support IPv6. Also tun-ipv6 is pushable by the remote so
not putting tun-ipv6 does not forbid ipv6 addresses.
This commit also clean up a bit of the ipv6 related tun.c. Changes for
most platforms are minimal.
For linux a bit more cleanup is done:
- Remove compatibility defines that were added 2008
- Always use IFF_NO_PI for the linux tun and not only for IPv4 only tun
setups (Android also always IFF_NO_PI works fine with Ipv6).
This commit also remove a non ipv6 fallback for tap driver from OpenVPN
2.2-beta or earlier and only warns.
Patch V2: Integrate Gert's comments
Patch V3: Remove tun_ipv4 option. It only used for MTU discovery and there
it was wrong since it should on the transport protocol if at all
Patch V4: Completely remove support for NetBSD <= 4.0 and remove
NETBSD_MULTI_AF defines
Patch V5: Assume generic OS in tun.c is also IPv6 capable. Add changes to
man page. Fix typos/change message as suggest by David.
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1476377656-3150-1-git-send-email-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12695.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
... | ... |
@@ -135,6 +135,10 @@ User-visible Changes |
135 | 135 |
ciphers configured in the config file. Use --ncp-disable if you don't want |
136 | 136 |
that. |
137 | 137 |
|
138 |
+- All tun devices on all platforms are always considered to be IPv6 |
|
139 |
+ capable. The --tun-ipv6 option is ignored (behaves like it is always |
|
140 |
+ on). |
|
141 |
+ |
|
138 | 142 |
|
139 | 143 |
Maintainer-visible changes |
140 | 144 |
-------------------------- |
... | ... |
@@ -797,18 +797,6 @@ changes the interpretation of the arguments of |
797 | 797 |
to mean "address netmask", no longer "local remote". |
798 | 798 |
.\"********************************************************* |
799 | 799 |
.TP |
800 |
-.B \-\-tun\-ipv6 |
|
801 |
-Build a tun link capable of forwarding IPv6 traffic. |
|
802 |
-Should be used in conjunction with |
|
803 |
-.B \-\-dev tun |
|
804 |
-or |
|
805 |
-.B \-\-dev tunX. |
|
806 |
-A warning will be displayed |
|
807 |
-if no specific IPv6 TUN support for your OS has been compiled into OpenVPN. |
|
808 |
- |
|
809 |
-See below for further IPv6-related configuration options. |
|
810 |
-.\"********************************************************* |
|
811 |
-.TP |
|
812 | 800 |
.B \-\-dev\-node node |
813 | 801 |
Explicitly set the device node rather than using |
814 | 802 |
/dev/net/tun, /dev/tun, /dev/tap, etc. If OpenVPN |
... | ... |
@@ -3600,7 +3588,7 @@ Clients that connect with options that are incompatible |
3600 | 3600 |
with those of the server will be disconnected. |
3601 | 3601 |
|
3602 | 3602 |
Options that will be compared for compatibility include |
3603 |
-dev\-type, link\-mtu, tun\-mtu, proto, tun\-ipv6, ifconfig, |
|
3603 |
+dev\-type, link\-mtu, tun\-mtu, proto, ifconfig, |
|
3604 | 3604 |
comp\-lzo, fragment, keydir, cipher, auth, keysize, secret, |
3605 | 3605 |
no\-replay, no\-iv, tls\-auth, key\-method, tls\-server, and tls\-client. |
3606 | 3606 |
|
... | ... |
@@ -5870,10 +5858,13 @@ is used. |
5870 | 5870 |
.B \-\-server\-ipv6 ipv6addr/bits |
5871 | 5871 |
convenience-function to enable a number of IPv6 related options at |
5872 | 5872 |
once, namely |
5873 |
-.B \-\-ifconfig\-ipv6, \-\-ifconfig\-ipv6\-pool, \-\-tun\-ipv6 |
|
5873 |
+.B \-\-ifconfig\-ipv6, \-\-ifconfig\-ipv6\-pool |
|
5874 | 5874 |
and |
5875 | 5875 |
.B \-\-push tun\-ipv6 |
5876 |
-Is only accepted if ``\-\-mode server'' or ``\-\-server'' is set. |
|
5876 |
+Is only accepted if ``\-\-mode server'' or ``\-\-server'' is set. Pushing of the |
|
5877 |
+.B \-\-tun\-ipv6 |
|
5878 |
+directive is done for older clients which require an explicit |
|
5879 |
+``\-\-tun\-ipv6'' in their configuration. |
|
5877 | 5880 |
.TP |
5878 | 5881 |
.B \-\-ifconfig\-ipv6\-pool ipv6addr/bits |
5879 | 5882 |
Specify an IPv6 address pool for dynamic assignment to clients. The |
... | ... |
@@ -391,7 +391,7 @@ check_fragment_dowork (struct context *c) |
391 | 391 |
struct link_socket_info *lsi = get_link_socket_info (c); |
392 | 392 |
|
393 | 393 |
/* OS MTU Hint? */ |
394 |
- if (lsi->mtu_changed && c->c2.ipv4_tun) |
|
394 |
+ if (lsi->mtu_changed) |
|
395 | 395 |
{ |
396 | 396 |
frame_adjust_path_mtu (&c->c2.frame_fragment, c->c2.link_socket->mtu, |
397 | 397 |
c->options.ce.proto); |
... | ... |
@@ -1400,9 +1400,6 @@ do_init_tun (struct context *c) |
1400 | 1400 |
!c->options.ifconfig_nowarn, |
1401 | 1401 |
c->c2.es); |
1402 | 1402 |
|
1403 |
- /* flag tunnel for IPv6 config if --tun-ipv6 is set */ |
|
1404 |
- c->c1.tuntap->ipv6 = c->options.tun_ipv6; |
|
1405 |
- |
|
1406 | 1403 |
init_tun_post (c->c1.tuntap, |
1407 | 1404 |
&c->c2.frame, |
1408 | 1405 |
&c->options.tuntap_options); |
... | ... |
@@ -1420,9 +1417,6 @@ do_open_tun (struct context *c) |
1420 | 1420 |
struct gc_arena gc = gc_new (); |
1421 | 1421 |
bool ret = false; |
1422 | 1422 |
|
1423 |
- c->c2.ipv4_tun = (!c->options.tun_ipv6 |
|
1424 |
- && is_dev_type (c->options.dev, c->options.dev_type, "tun")); |
|
1425 |
- |
|
1426 | 1423 |
#ifndef TARGET_ANDROID |
1427 | 1424 |
if (!c->c1.tuntap) |
1428 | 1425 |
{ |
... | ... |
@@ -1378,8 +1378,7 @@ multi_select_virtual_addr (struct multi_context *m, struct multi_instance *mi) |
1378 | 1378 |
* (see below) so issue a warning if that happens - don't break the |
1379 | 1379 |
* session, though, as we don't even know if this client WANTS IPv6 |
1380 | 1380 |
*/ |
1381 |
- if ( mi->context.c1.tuntap->ipv6 && |
|
1382 |
- mi->context.options.ifconfig_ipv6_pool_defined && |
|
1381 |
+ if ( mi->context.options.ifconfig_ipv6_pool_defined && |
|
1383 | 1382 |
! mi->context.options.push_ifconfig_ipv6_defined ) |
1384 | 1383 |
{ |
1385 | 1384 |
msg( M_INFO, "MULTI_sva: WARNING: if --ifconfig-push is used for IPv4, automatic IPv6 assignment from --ifconfig-ipv6-pool does not work. Use --ifconfig-ipv6-push for IPv6 then." ); |
... | ... |
@@ -1452,8 +1451,7 @@ multi_select_virtual_addr (struct multi_context *m, struct multi_instance *mi) |
1452 | 1452 |
* way round ("dynamic IPv4, static IPv6") or "both static" makes sense |
1453 | 1453 |
* -> and so it's implemented right now |
1454 | 1454 |
*/ |
1455 |
- if ( mi->context.c1.tuntap->ipv6 && |
|
1456 |
- mi->context.options.push_ifconfig_ipv6_defined ) |
|
1455 |
+ if ( mi->context.options.push_ifconfig_ipv6_defined ) |
|
1457 | 1456 |
{ |
1458 | 1457 |
mi->context.c2.push_ifconfig_ipv6_local = |
1459 | 1458 |
mi->context.options.push_ifconfig_ipv6_local; |
... | ... |
@@ -1511,7 +1509,7 @@ multi_set_virtual_addr_env (struct multi_context *m, struct multi_instance *mi) |
1511 | 1511 |
setenv_del (mi->context.c2.es, "ifconfig_pool_remote_ip6"); |
1512 | 1512 |
setenv_del (mi->context.c2.es, "ifconfig_pool_ip6_netbits"); |
1513 | 1513 |
|
1514 |
- if (mi->context.c1.tuntap->ipv6 && mi->context.c2.push_ifconfig_ipv6_defined) |
|
1514 |
+ if (mi->context.c2.push_ifconfig_ipv6_defined) |
|
1515 | 1515 |
{ |
1516 | 1516 |
setenv_in6_addr (mi->context.c2.es, |
1517 | 1517 |
"ifconfig_pool_remote", |
... | ... |
@@ -175,7 +175,6 @@ static const char usage_message[] = |
175 | 175 |
" /dev/net/tun, /dev/tun, /dev/tap, etc.\n" |
176 | 176 |
"--lladdr hw : Set the link layer address of the tap device.\n" |
177 | 177 |
"--topology t : Set --dev tun topology: 'net30', 'p2p', or 'subnet'.\n" |
178 |
- "--tun-ipv6 : Build tun link capable of forwarding IPv6 traffic.\n" |
|
179 | 178 |
#ifdef ENABLE_IPROUTE |
180 | 179 |
"--iproute cmd : Use this command instead of default " IPROUTE_PATH ".\n" |
181 | 180 |
#endif |
... | ... |
@@ -1500,7 +1499,6 @@ show_settings (const struct options *o) |
1500 | 1500 |
SHOW_STR (dev_node); |
1501 | 1501 |
SHOW_STR (lladdr); |
1502 | 1502 |
SHOW_INT (topology); |
1503 |
- SHOW_BOOL (tun_ipv6); |
|
1504 | 1503 |
SHOW_STR (ifconfig_local); |
1505 | 1504 |
SHOW_STR (ifconfig_remote_netmask); |
1506 | 1505 |
SHOW_BOOL (ifconfig_noexec); |
... | ... |
@@ -2103,10 +2101,6 @@ options_postprocess_verify_ce (const struct options *options, const struct conne |
2103 | 2103 |
options->connection_list->array[0]->remote) |
2104 | 2104 |
msg (M_USAGE, "<connection> cannot be used with --mode server"); |
2105 | 2105 |
|
2106 |
-#if 0 |
|
2107 |
- if (options->tun_ipv6) |
|
2108 |
- msg (M_USAGE, "--tun-ipv6 cannot be used with --mode server"); |
|
2109 |
-#endif |
|
2110 | 2106 |
if (options->shaper) |
2111 | 2107 |
msg (M_USAGE, "--shaper cannot be used with --mode server"); |
2112 | 2108 |
if (options->inetd) |
... | ... |
@@ -2130,9 +2124,6 @@ options_postprocess_verify_ce (const struct options *options, const struct conne |
2130 | 2130 |
msg (M_USAGE, "--ifconfig-pool-persist must be used with --ifconfig-pool"); |
2131 | 2131 |
if (options->ifconfig_ipv6_pool_defined && !options->ifconfig_ipv6_local ) |
2132 | 2132 |
msg (M_USAGE, "--ifconfig-ipv6-pool needs --ifconfig-ipv6"); |
2133 |
- if (options->ifconfig_ipv6_local && !options->tun_ipv6 ) |
|
2134 |
- msg (M_INFO, "Warning: --ifconfig-ipv6 without --tun-ipv6 will not do IPv6"); |
|
2135 |
- |
|
2136 | 2133 |
if (options->auth_user_pass_file) |
2137 | 2134 |
msg (M_USAGE, "--auth-user-pass cannot be used with --mode server (it should be used on the client side only)"); |
2138 | 2135 |
if (options->ccd_exclusive && !options->client_config_dir) |
... | ... |
@@ -3081,7 +3072,7 @@ options_string (const struct options *o, |
3081 | 3081 |
/* send tun_ipv6 only in peer2peer mode - in client/server mode, it |
3082 | 3082 |
* is usually pushed by the server, triggering a non-helpful warning |
3083 | 3083 |
*/ |
3084 |
- if (o->tun_ipv6 && o->mode == MODE_POINT_TO_POINT && !PULL_DEFINED(o)) |
|
3084 |
+ if (o->ifconfig_ipv6_local && o->mode == MODE_POINT_TO_POINT && !PULL_DEFINED(o)) |
|
3085 | 3085 |
buf_printf (&out, ",tun-ipv6"); |
3086 | 3086 |
|
3087 | 3087 |
/* |
... | ... |
@@ -4582,7 +4573,7 @@ add_option (struct options *options, |
4582 | 4582 |
else if (streq (p[0], "tun-ipv6") && !p[1]) |
4583 | 4583 |
{ |
4584 | 4584 |
VERIFY_PERMISSION (OPT_P_UP); |
4585 |
- options->tun_ipv6 = true; |
|
4585 |
+ msg (M_WARN, "Note: option tun-ipv6 is ignored because modern operating systems do not need special IPv6 tun handling anymore."); |
|
4586 | 4586 |
} |
4587 | 4587 |
#ifdef ENABLE_IPROUTE |
4588 | 4588 |
else if (streq (p[0], "iproute") && p[1] && !p[2]) |
... | ... |
@@ -251,7 +251,6 @@ struct options |
251 | 251 |
int ping_send_timeout; /* Send a TCP/UDP ping to remote every n seconds */ |
252 | 252 |
int ping_rec_timeout; /* Expect a TCP/UDP ping from remote at least once every n seconds */ |
253 | 253 |
bool ping_timer_remote; /* Run ping timer only if we have a remote address */ |
254 |
- bool tun_ipv6; /* Build tun dev that supports IPv6 */ |
|
255 | 254 |
|
256 | 255 |
# define PING_UNDEF 0 |
257 | 256 |
# define PING_EXIT 1 |
... | ... |
@@ -1718,10 +1718,11 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla |
1718 | 1718 |
} |
1719 | 1719 |
#endif |
1720 | 1720 |
|
1721 |
- if ( !tt->ipv6 ) |
|
1721 |
+ if (!tt->did_ifconfig_ipv6_setup) |
|
1722 | 1722 |
{ |
1723 |
- msg( M_INFO, "add_route_ipv6(): not adding %s/%d, no IPv6 on if %s", |
|
1724 |
- network, r6->netbits, device ); |
|
1723 |
+ msg( M_INFO, "add_route_ipv6(): not adding %s/%d: " |
|
1724 |
+ "no IPv6 address been configured on interface %s", |
|
1725 |
+ network, r6->netbits, device); |
|
1725 | 1726 |
return; |
1726 | 1727 |
} |
1727 | 1728 |
|
... | ... |
@@ -2148,13 +2149,6 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne |
2148 | 2148 |
} |
2149 | 2149 |
#endif |
2150 | 2150 |
|
2151 |
- if ( !tt->ipv6 ) |
|
2152 |
- { |
|
2153 |
- msg( M_INFO, "delete_route_ipv6(): not deleting %s/%d, no IPv6 on if %s", |
|
2154 |
- network, r6->netbits, device ); |
|
2155 |
- return; |
|
2156 |
- } |
|
2157 |
- |
|
2158 | 2151 |
msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits ); |
2159 | 2152 |
|
2160 | 2153 |
/* if we used a gateway on "add route", we also need to specify it on |
... | ... |
@@ -741,8 +741,8 @@ do_ifconfig (struct tuntap *tt, |
741 | 741 |
|
742 | 742 |
argv_init (&argv); |
743 | 743 |
|
744 |
- msg( M_INFO, "do_ifconfig, tt->ipv6=%d, tt->did_ifconfig_ipv6_setup=%d", |
|
745 |
- tt->ipv6, tt->did_ifconfig_ipv6_setup ); |
|
744 |
+ msg( M_DEBUG, "do_ifconfig, tt->did_ifconfig_ipv6_setup=%d", |
|
745 |
+ tt->did_ifconfig_ipv6_setup ); |
|
746 | 746 |
|
747 | 747 |
/* |
748 | 748 |
* We only handle TUN/TAP devices here, not --dev null devices. |
... | ... |
@@ -755,7 +755,7 @@ do_ifconfig (struct tuntap *tt, |
755 | 755 |
ifconfig_local = print_in_addr_t (tt->local, 0, &gc); |
756 | 756 |
ifconfig_remote_netmask = print_in_addr_t (tt->remote_netmask, 0, &gc); |
757 | 757 |
|
758 |
- if ( tt->ipv6 && tt->did_ifconfig_ipv6_setup ) |
|
758 |
+ if (tt->did_ifconfig_ipv6_setup ) |
|
759 | 759 |
{ |
760 | 760 |
ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0, &gc); |
761 | 761 |
ifconfig_ipv6_remote = print_in6_addr (tt->remote_ipv6, 0, &gc); |
... | ... |
@@ -1077,13 +1077,6 @@ do_ifconfig (struct tuntap *tt, |
1077 | 1077 |
|
1078 | 1078 |
#elif defined(TARGET_NETBSD) |
1079 | 1079 |
|
1080 |
-/* whether or not NetBSD can do IPv6 can be seen by the availability of |
|
1081 |
- * the TUNSIFHEAD ioctl() - see next TARGET_NETBSD block for more details |
|
1082 |
- */ |
|
1083 |
-#ifdef TUNSIFHEAD |
|
1084 |
-# define NETBSD_MULTI_AF |
|
1085 |
-#endif |
|
1086 |
- |
|
1087 | 1080 |
if (tun) |
1088 | 1081 |
argv_printf (&argv, |
1089 | 1082 |
"%s %s %s %s mtu %d netmask 255.255.255.255 up", |
... | ... |
@@ -1126,7 +1119,6 @@ do_ifconfig (struct tuntap *tt, |
1126 | 1126 |
|
1127 | 1127 |
if ( do_ipv6 ) |
1128 | 1128 |
{ |
1129 |
-#ifdef NETBSD_MULTI_AF |
|
1130 | 1129 |
argv_printf (&argv, |
1131 | 1130 |
"%s %s inet6 %s/%d", |
1132 | 1131 |
IFCONFIG_PATH, |
... | ... |
@@ -1139,10 +1131,6 @@ do_ifconfig (struct tuntap *tt, |
1139 | 1139 |
|
1140 | 1140 |
/* and, hooray, we explicitely need to add a route... */ |
1141 | 1141 |
add_route_connected_v6_net(tt, es); |
1142 |
-#else |
|
1143 |
- msg( M_INFO, "no IPv6 support for tun interfaces on NetBSD before 4.0 (if your system is newer, recompile openvpn)" ); |
|
1144 |
- tt->ipv6 = false; |
|
1145 |
-#endif |
|
1146 | 1142 |
} |
1147 | 1143 |
tt->did_ifconfig = true; |
1148 | 1144 |
|
... | ... |
@@ -1425,7 +1413,6 @@ clear_tuntap (struct tuntap *tuntap) |
1425 | 1425 |
#ifdef TARGET_SOLARIS |
1426 | 1426 |
tuntap->ip_fd = -1; |
1427 | 1427 |
#endif |
1428 |
- tuntap->ipv6 = false; |
|
1429 | 1428 |
} |
1430 | 1429 |
|
1431 | 1430 |
static void |
... | ... |
@@ -1478,7 +1465,7 @@ write_tun_header (struct tuntap* tt, uint8_t *buf, int len) |
1478 | 1478 |
|
1479 | 1479 |
iph = (struct ip *) buf; |
1480 | 1480 |
|
1481 |
- if (tt->ipv6 && iph->ip_v == 6) |
|
1481 |
+ if (iph->ip_v == 6) |
|
1482 | 1482 |
type = htonl (AF_INET6); |
1483 | 1483 |
else |
1484 | 1484 |
type = htonl (AF_INET); |
... | ... |
@@ -1518,17 +1505,12 @@ read_tun_header (struct tuntap* tt, uint8_t *buf, int len) |
1518 | 1518 |
#ifndef WIN32 |
1519 | 1519 |
static void |
1520 | 1520 |
open_tun_generic (const char *dev, const char *dev_type, const char *dev_node, |
1521 |
- bool ipv6_explicitly_supported, bool dynamic, |
|
1522 |
- struct tuntap *tt) |
|
1521 |
+ bool dynamic, struct tuntap *tt) |
|
1523 | 1522 |
{ |
1524 | 1523 |
char tunname[256]; |
1525 | 1524 |
char dynamic_name[256]; |
1526 | 1525 |
bool dynamic_opened = false; |
1527 | 1526 |
|
1528 |
- |
|
1529 |
- if ( tt->ipv6 && ! ipv6_explicitly_supported ) |
|
1530 |
- msg (M_WARN, "NOTE: explicit support for IPv6 tun devices is not provided for this OS"); |
|
1531 |
- |
|
1532 | 1527 |
if (tt->type == DEV_TYPE_NULL) |
1533 | 1528 |
{ |
1534 | 1529 |
open_null (tt); |
... | ... |
@@ -1710,7 +1692,6 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len) |
1710 | 1710 |
} |
1711 | 1711 |
|
1712 | 1712 |
#elif defined(TARGET_LINUX) |
1713 |
-#ifdef HAVE_LINUX_IF_TUN_H /* New driver support */ |
|
1714 | 1713 |
|
1715 | 1714 |
#ifndef HAVE_LINUX_SOCKIOS_H |
1716 | 1715 |
#error header file linux/sockios.h required |
... | ... |
@@ -1751,8 +1732,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
1751 | 1751 |
* Process --tun-ipv6 |
1752 | 1752 |
*/ |
1753 | 1753 |
CLEAR (ifr); |
1754 |
- if (!tt->ipv6) |
|
1755 |
- ifr.ifr_flags = IFF_NO_PI; |
|
1754 |
+ ifr.ifr_flags = IFF_NO_PI; |
|
1756 | 1755 |
|
1757 | 1756 |
#if defined(IFF_ONE_QUEUE) && defined(SIOCSIFTXQLEN) |
1758 | 1757 |
ifr.ifr_flags |= IFF_ONE_QUEUE; |
... | ... |
@@ -1833,32 +1813,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
1833 | 1833 |
ASSERT (0); |
1834 | 1834 |
} |
1835 | 1835 |
|
1836 |
-#endif |
|
1837 |
- |
|
1838 |
-#else |
|
1839 |
- |
|
1840 |
-void |
|
1841 |
-open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) |
|
1842 |
-{ |
|
1843 |
- open_tun_generic (dev, dev_type, dev_node, false, true, tt); |
|
1844 |
-} |
|
1845 |
- |
|
1846 |
-#endif /* HAVE_LINUX_IF_TUN_H */ |
|
1836 |
+#endif /* !PENDANTIC */ |
|
1847 | 1837 |
|
1848 | 1838 |
#ifdef ENABLE_FEATURE_TUN_PERSIST |
1849 | 1839 |
|
1850 |
-/* |
|
1851 |
- * This can be removed in future |
|
1852 |
- * when all systems will use newer |
|
1853 |
- * linux-headers |
|
1854 |
- */ |
|
1855 |
-#ifndef TUNSETOWNER |
|
1856 |
-#define TUNSETOWNER _IOW('T', 204, int) |
|
1857 |
-#endif |
|
1858 |
-#ifndef TUNSETGROUP |
|
1859 |
-#define TUNSETGROUP _IOW('T', 206, int) |
|
1860 |
-#endif |
|
1861 |
- |
|
1862 | 1840 |
void |
1863 | 1841 |
tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist_mode, const char *username, const char *groupname, const struct tuntap_options *options) |
1864 | 1842 |
{ |
... | ... |
@@ -1940,7 +1898,7 @@ close_tun (struct tuntap *tt) |
1940 | 1940 |
argv_msg (M_INFO, &argv); |
1941 | 1941 |
openvpn_execve_check (&argv, NULL, 0, "Linux ip addr del failed"); |
1942 | 1942 |
|
1943 |
- if (tt->ipv6 && tt->did_ifconfig_ipv6_setup) |
|
1943 |
+ if (tt->did_ifconfig_ipv6_setup) |
|
1944 | 1944 |
{ |
1945 | 1945 |
const char * ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0, &gc); |
1946 | 1946 |
|
... | ... |
@@ -1977,53 +1935,13 @@ close_tun (struct tuntap *tt) |
1977 | 1977 |
int |
1978 | 1978 |
write_tun (struct tuntap* tt, uint8_t *buf, int len) |
1979 | 1979 |
{ |
1980 |
- if (tt->ipv6) |
|
1981 |
- { |
|
1982 |
- struct tun_pi pi; |
|
1983 |
- struct iphdr *iph; |
|
1984 |
- struct iovec vect[2]; |
|
1985 |
- int ret; |
|
1986 |
- |
|
1987 |
- iph = (struct iphdr *)buf; |
|
1988 |
- |
|
1989 |
- pi.flags = 0; |
|
1990 |
- |
|
1991 |
- if(iph->version == 6) |
|
1992 |
- pi.proto = htons(OPENVPN_ETH_P_IPV6); |
|
1993 |
- else |
|
1994 |
- pi.proto = htons(OPENVPN_ETH_P_IPV4); |
|
1995 |
- |
|
1996 |
- vect[0].iov_len = sizeof(pi); |
|
1997 |
- vect[0].iov_base = π |
|
1998 |
- vect[1].iov_len = len; |
|
1999 |
- vect[1].iov_base = buf; |
|
2000 |
- |
|
2001 |
- ret = writev(tt->fd, vect, 2); |
|
2002 |
- return(ret - sizeof(pi)); |
|
2003 |
- } |
|
2004 |
- else |
|
2005 |
- return write (tt->fd, buf, len); |
|
1980 |
+ return write (tt->fd, buf, len); |
|
2006 | 1981 |
} |
2007 | 1982 |
|
2008 | 1983 |
int |
2009 | 1984 |
read_tun (struct tuntap* tt, uint8_t *buf, int len) |
2010 | 1985 |
{ |
2011 |
- if (tt->ipv6) |
|
2012 |
- { |
|
2013 |
- struct iovec vect[2]; |
|
2014 |
- struct tun_pi pi; |
|
2015 |
- int ret; |
|
2016 |
- |
|
2017 |
- vect[0].iov_len = sizeof(pi); |
|
2018 |
- vect[0].iov_base = π |
|
2019 |
- vect[1].iov_len = len; |
|
2020 |
- vect[1].iov_base = buf; |
|
2021 |
- |
|
2022 |
- ret = readv(tt->fd, vect, 2); |
|
2023 |
- return(ret - sizeof(pi)); |
|
2024 |
- } |
|
2025 |
- else |
|
2026 |
- return read (tt->fd, buf, len); |
|
1986 |
+ return read (tt->fd, buf, len); |
|
2027 | 1987 |
} |
2028 | 1988 |
|
2029 | 1989 |
#elif defined(TARGET_SOLARIS) |
... | ... |
@@ -2227,7 +2145,7 @@ solaris_close_tun (struct tuntap *tt) |
2227 | 2227 |
if (tt) |
2228 | 2228 |
{ |
2229 | 2229 |
/* IPv6 interfaces need to be 'manually' de-configured */ |
2230 |
- if ( tt->ipv6 && tt->did_ifconfig_ipv6_setup ) |
|
2230 |
+ if ( tt->did_ifconfig_ipv6_setup ) |
|
2231 | 2231 |
{ |
2232 | 2232 |
struct argv argv; |
2233 | 2233 |
argv_init (&argv); |
... | ... |
@@ -2341,7 +2259,7 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len) |
2341 | 2341 |
void |
2342 | 2342 |
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) |
2343 | 2343 |
{ |
2344 |
- open_tun_generic (dev, dev_type, dev_node, true, true, tt); |
|
2344 |
+ open_tun_generic (dev, dev_type, dev_node, true, tt); |
|
2345 | 2345 |
|
2346 | 2346 |
/* Enable multicast on the interface */ |
2347 | 2347 |
if (tt->fd >= 0) |
... | ... |
@@ -2435,11 +2353,7 @@ read_tun (struct tuntap *tt, uint8_t *buf, int len) |
2435 | 2435 |
void |
2436 | 2436 |
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) |
2437 | 2437 |
{ |
2438 |
-#ifdef NETBSD_MULTI_AF |
|
2439 |
- open_tun_generic (dev, dev_type, dev_node, true, true, tt); |
|
2440 |
-#else |
|
2441 |
- open_tun_generic (dev, dev_type, dev_node, false, true, tt); |
|
2442 |
-#endif |
|
2438 |
+ open_tun_generic (dev, dev_type, dev_node, true, tt); |
|
2443 | 2439 |
|
2444 | 2440 |
if (tt->fd >= 0) |
2445 | 2441 |
{ |
... | ... |
@@ -2448,7 +2362,6 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
2448 | 2448 |
i = 0; |
2449 | 2449 |
ioctl (tt->fd, TUNSLMODE, &i); /* link layer mode off */ |
2450 | 2450 |
|
2451 |
-#ifdef NETBSD_MULTI_AF |
|
2452 | 2451 |
if ( tt->type == DEV_TYPE_TUN ) |
2453 | 2452 |
{ |
2454 | 2453 |
i = 1; |
... | ... |
@@ -2457,7 +2370,6 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
2457 | 2457 |
msg (M_WARN | M_ERRNO, "ioctl(TUNSIFHEAD): %s", strerror(errno)); |
2458 | 2458 |
} |
2459 | 2459 |
} |
2460 |
-#endif |
|
2461 | 2460 |
} |
2462 | 2461 |
} |
2463 | 2462 |
|
... | ... |
@@ -2496,8 +2408,6 @@ close_tun (struct tuntap *tt) |
2496 | 2496 |
} |
2497 | 2497 |
} |
2498 | 2498 |
|
2499 |
-#ifdef NETBSD_MULTI_AF |
|
2500 |
- |
|
2501 | 2499 |
static inline int |
2502 | 2500 |
netbsd_modify_read_write_return (int len) |
2503 | 2501 |
{ |
... | ... |
@@ -2518,7 +2428,7 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len) |
2518 | 2518 |
|
2519 | 2519 |
iph = (struct openvpn_iphdr *) buf; |
2520 | 2520 |
|
2521 |
- if (tt->ipv6 && OPENVPN_IPH_GET_VER(iph->version_len) == 6) |
|
2521 |
+ if (OPENVPN_IPH_GET_VER(iph->version_len) == 6) |
|
2522 | 2522 |
type = htonl (AF_INET6); |
2523 | 2523 |
else |
2524 | 2524 |
type = htonl (AF_INET); |
... | ... |
@@ -2553,21 +2463,6 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len) |
2553 | 2553 |
return read (tt->fd, buf, len); |
2554 | 2554 |
} |
2555 | 2555 |
|
2556 |
-#else /* not NETBSD_MULTI_AF -> older code, IPv4 only */ |
|
2557 |
- |
|
2558 |
-int |
|
2559 |
-write_tun (struct tuntap* tt, uint8_t *buf, int len) |
|
2560 |
-{ |
|
2561 |
- return write (tt->fd, buf, len); |
|
2562 |
-} |
|
2563 |
- |
|
2564 |
-int |
|
2565 |
-read_tun (struct tuntap* tt, uint8_t *buf, int len) |
|
2566 |
-{ |
|
2567 |
- return read (tt->fd, buf, len); |
|
2568 |
-} |
|
2569 |
-#endif /* NETBSD_MULTI_AF */ |
|
2570 |
- |
|
2571 | 2556 |
#elif defined(TARGET_FREEBSD) |
2572 | 2557 |
|
2573 | 2558 |
static inline int |
... | ... |
@@ -2582,7 +2477,7 @@ freebsd_modify_read_write_return (int len) |
2582 | 2582 |
void |
2583 | 2583 |
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) |
2584 | 2584 |
{ |
2585 |
- open_tun_generic (dev, dev_type, dev_node, true, true, tt); |
|
2585 |
+ open_tun_generic (dev, dev_type, dev_node, true, tt); |
|
2586 | 2586 |
|
2587 | 2587 |
if (tt->fd >= 0 && tt->type == DEV_TYPE_TUN) |
2588 | 2588 |
{ |
... | ... |
@@ -2644,7 +2539,7 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len) |
2644 | 2644 |
|
2645 | 2645 |
iph = (struct ip *) buf; |
2646 | 2646 |
|
2647 |
- if (tt->ipv6 && iph->ip_v == 6) |
|
2647 |
+ if (iph->ip_v == 6) |
|
2648 | 2648 |
type = htonl (AF_INET6); |
2649 | 2649 |
else |
2650 | 2650 |
type = htonl (AF_INET); |
... | ... |
@@ -2693,7 +2588,7 @@ dragonfly_modify_read_write_return (int len) |
2693 | 2693 |
void |
2694 | 2694 |
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) |
2695 | 2695 |
{ |
2696 |
- open_tun_generic (dev, dev_type, dev_node, true, true, tt); |
|
2696 |
+ open_tun_generic (dev, dev_type, dev_node, true, tt); |
|
2697 | 2697 |
|
2698 | 2698 |
if (tt->fd >= 0) |
2699 | 2699 |
{ |
... | ... |
@@ -2727,7 +2622,7 @@ write_tun (struct tuntap* tt, uint8_t *buf, int len) |
2727 | 2727 |
|
2728 | 2728 |
iph = (struct ip *) buf; |
2729 | 2729 |
|
2730 |
- if (tt->ipv6 && iph->ip_v == 6) |
|
2730 |
+ if (iph->ip_v == 6) |
|
2731 | 2731 |
type = htonl (AF_INET6); |
2732 | 2732 |
else |
2733 | 2733 |
type = htonl (AF_INET); |
... | ... |
@@ -2920,7 +2815,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
2920 | 2920 |
{ |
2921 | 2921 |
/* No explicit utun and utun failed, try the generic way) */ |
2922 | 2922 |
msg (M_INFO, "Failed to open utun device. Falling back to /dev/tun device"); |
2923 |
- open_tun_generic (dev, dev_type, NULL, true, true, tt); |
|
2923 |
+ open_tun_generic (dev, dev_type, NULL, true, tt); |
|
2924 | 2924 |
} |
2925 | 2925 |
else |
2926 | 2926 |
{ |
... | ... |
@@ -2941,7 +2836,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
2941 | 2941 |
if (dev_node && strcmp (dev_node, "tun")==0) |
2942 | 2942 |
dev_node=NULL; |
2943 | 2943 |
|
2944 |
- open_tun_generic (dev, dev_type, dev_node, true, true, tt); |
|
2944 |
+ open_tun_generic (dev, dev_type, dev_node, true, tt); |
|
2945 | 2945 |
} |
2946 | 2946 |
} |
2947 | 2947 |
|
... | ... |
@@ -2954,7 +2849,7 @@ close_tun (struct tuntap* tt) |
2954 | 2954 |
struct argv argv; |
2955 | 2955 |
argv_init (&argv); |
2956 | 2956 |
|
2957 |
- if ( tt->ipv6 && tt->did_ifconfig_ipv6_setup ) |
|
2957 |
+ if (tt->did_ifconfig_ipv6_setup ) |
|
2958 | 2958 |
{ |
2959 | 2959 |
const char * ifconfig_ipv6_local = |
2960 | 2960 |
print_in6_addr (tt->local_ipv6, 0, &gc); |
... | ... |
@@ -5182,7 +5077,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
5182 | 5182 |
|
5183 | 5183 |
/*netcmd_semaphore_lock ();*/ |
5184 | 5184 |
|
5185 |
- msg( M_INFO, "open_tun, tt->ipv6=%d", tt->ipv6 ); |
|
5185 |
+ msg( M_INFO, "open_tun"); |
|
5186 | 5186 |
|
5187 | 5187 |
if (tt->type == DEV_TYPE_NULL) |
5188 | 5188 |
{ |
... | ... |
@@ -5308,11 +5203,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
5308 | 5308 |
/* usage of numeric constants is ugly, but this is really tied to |
5309 | 5309 |
* *this* version of the driver |
5310 | 5310 |
*/ |
5311 |
- if ( tt->ipv6 && tt->type == DEV_TYPE_TUN && |
|
5311 |
+ if (tt->type == DEV_TYPE_TUN && |
|
5312 | 5312 |
info[0] == 9 && info[1] < 8) |
5313 | 5313 |
{ |
5314 |
- msg( M_INFO, "WARNING: Tap-Win32 driver version %d.%d does not support IPv6 in TUN mode. IPv6 will be disabled. Upgrade to Tap-Win32 9.8 (2.2-beta3 release or later) or use TAP mode to get IPv6", (int) info[0], (int) info[1] ); |
|
5315 |
- tt->ipv6 = false; |
|
5314 |
+ msg( M_INFO, "WARNING: Tap-Win32 driver version %d.%d does not support IPv6 in TUN mode. IPv6 will not work. Upgrade your Tap-Win32 driver.", (int) info[0], (int) info[1] ); |
|
5316 | 5315 |
} |
5317 | 5316 |
|
5318 | 5317 |
/* tap driver 9.8 (2.2.0 and 2.2.1 release) is buggy |
... | ... |
@@ -5320,7 +5214,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu |
5320 | 5320 |
if ( tt->type == DEV_TYPE_TUN && |
5321 | 5321 |
info[0] == 9 && info[1] == 8) |
5322 | 5322 |
{ |
5323 |
- msg( M_FATAL, "ERROR: Tap-Win32 driver version %d.%d is buggy regarding small IPv4 packets in TUN mode. Upgrade to Tap-Win32 9.9 (2.2.2 release or later) or use TAP mode", (int) info[0], (int) info[1] ); |
|
5323 |
+ msg( M_FATAL, "ERROR: Tap-Win32 driver version %d.%d is buggy regarding small IPv4 packets in TUN mode. Upgrade your Tap-Win32 driver.", (int) info[0], (int) info[1] ); |
|
5324 | 5324 |
} |
5325 | 5325 |
} |
5326 | 5326 |
|
... | ... |
@@ -5653,7 +5547,7 @@ close_tun (struct tuntap *tt) |
5653 | 5653 |
|
5654 | 5654 |
if (tt) |
5655 | 5655 |
{ |
5656 |
- if ( tt->ipv6 && tt->did_ifconfig_ipv6_setup ) |
|
5656 |
+ if ( tt->did_ifconfig_ipv6_setup ) |
|
5657 | 5657 |
{ |
5658 | 5658 |
if (tt->options.msg_channel) |
5659 | 5659 |
{ |
... | ... |
@@ -5790,7 +5684,7 @@ ipset2ascii_all (struct gc_arena *gc) |
5790 | 5790 |
void |
5791 | 5791 |
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) |
5792 | 5792 |
{ |
5793 |
- open_tun_generic (dev, dev_type, dev_node, false, true, tt); |
|
5793 |
+ open_tun_generic (dev, dev_type, dev_node, true, tt); |
|
5794 | 5794 |
} |
5795 | 5795 |
|
5796 | 5796 |
void |