Fixes two compiler warnings identified by using CFLAGS=-O2
1) ifconfig_ipv6_remote is only used on Solaris, move the
declaration and assignment of this variable into the
TARGET_SOLARIS block.
2) Linux have it's own open_tun() function and does not
depend on open_tun_generic() at all. So exclude
open_tun_generic() if TARGET_LINUX is defined.
v2 - Move changes from 1) into the proper if() block
directly
- Fix up incorrect comment tags related to changes in 2)
v3 - Minor coding style adjustments and change WIN32 to _WIN32
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1479165185-11730-1-git-send-email-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13063.html
| ... | ... |
@@ -751,7 +751,6 @@ do_ifconfig (struct tuntap *tt, |
| 751 | 751 |
const char *ifconfig_remote_netmask = NULL; |
| 752 | 752 |
const char *ifconfig_broadcast = NULL; |
| 753 | 753 |
const char *ifconfig_ipv6_local = NULL; |
| 754 |
- const char *ifconfig_ipv6_remote = NULL; |
|
| 755 | 754 |
bool do_ipv6 = false; |
| 756 | 755 |
struct argv argv = argv_new (); |
| 757 | 756 |
|
| ... | ... |
@@ -772,7 +771,6 @@ do_ifconfig (struct tuntap *tt, |
| 772 | 772 |
if (tt->did_ifconfig_ipv6_setup ) |
| 773 | 773 |
{
|
| 774 | 774 |
ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0, &gc); |
| 775 |
- ifconfig_ipv6_remote = print_in6_addr (tt->remote_ipv6, 0, &gc); |
|
| 776 | 775 |
do_ipv6 = true; |
| 777 | 776 |
} |
| 778 | 777 |
|
| ... | ... |
@@ -915,7 +913,6 @@ do_ifconfig (struct tuntap *tt, |
| 915 | 915 |
management_android_control (management, "IFCONFIG", buf_bptr(&out)); |
| 916 | 916 |
|
| 917 | 917 |
#elif defined(TARGET_SOLARIS) |
| 918 |
- |
|
| 919 | 918 |
/* Solaris 2.6 (and 7?) cannot set all parameters in one go... |
| 920 | 919 |
* example: |
| 921 | 920 |
* ifconfig tun2 10.2.0.2 10.2.0.1 mtu 1450 up |
| ... | ... |
@@ -977,6 +974,9 @@ do_ifconfig (struct tuntap *tt, |
| 977 | 977 |
|
| 978 | 978 |
if ( tt->type == DEV_TYPE_TUN ) |
| 979 | 979 |
{
|
| 980 |
+ const char *ifconfig_ipv6_remote = |
|
| 981 |
+ ifconfig_ipv6_remote = print_in6_addr (tt->remote_ipv6, 0, &gc); |
|
| 982 |
+ |
|
| 980 | 983 |
argv_printf (&argv, |
| 981 | 984 |
"%s %s inet6 plumb %s/%d %s up", |
| 982 | 985 |
IFCONFIG_PATH, |
| ... | ... |
@@ -1502,7 +1502,7 @@ read_tun_header (struct tuntap* tt, uint8_t *buf, int len) |
| 1502 | 1502 |
#endif |
| 1503 | 1503 |
|
| 1504 | 1504 |
|
| 1505 |
-#ifndef _WIN32 |
|
| 1505 |
+#if !(defined(_WIN32) || defined(TARGET_LINUX)) |
|
| 1506 | 1506 |
static void |
| 1507 | 1507 |
open_tun_generic (const char *dev, const char *dev_type, const char *dev_node, |
| 1508 | 1508 |
bool dynamic, struct tuntap *tt) |
| ... | ... |
@@ -1604,7 +1604,9 @@ open_tun_generic (const char *dev, const char *dev_type, const char *dev_node, |
| 1604 | 1604 |
tt->actual_name = string_alloc (dynamic_opened ? dynamic_name : dev, NULL); |
| 1605 | 1605 |
} |
| 1606 | 1606 |
} |
| 1607 |
+#endif /* !_WIN32 && !TARGET_LINUX */ |
|
| 1607 | 1608 |
|
| 1609 |
+#if !defined(_WIN32) |
|
| 1608 | 1610 |
static void |
| 1609 | 1611 |
close_tun_generic (struct tuntap *tt) |
| 1610 | 1612 |
{
|
| ... | ... |
@@ -1614,8 +1616,7 @@ close_tun_generic (struct tuntap *tt) |
| 1614 | 1614 |
free (tt->actual_name); |
| 1615 | 1615 |
clear_tuntap (tt); |
| 1616 | 1616 |
} |
| 1617 |
- |
|
| 1618 |
-#endif |
|
| 1617 |
+#endif /* !_WIN32 */ |
|
| 1619 | 1618 |
|
| 1620 | 1619 |
#if defined (TARGET_ANDROID) |
| 1621 | 1620 |
void |