From: "cron2 (Code Review)" Date: Sat, 2 Dec 2023 16:27:31 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <548bc5809d3ca65007c6a70e5b68af4fbebd841c-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="9umcKYCy4RQ="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Minimal Solaris/OpenIndiana support to Cmake and clean up -Werror List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --9umcKYCy4RQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/458?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by flichtenheld Change subject: Minimal Solaris/OpenIndiana support to Cmake and clean up -= Werror ...................................................................... Minimal Solaris/OpenIndiana support to Cmake and clean up -Werror Change-Id: I66e3dd7b7166459526824fe5ae81a449b375b8db Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld Message-Id: <20231128111447.64445-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27= 581.html Signed-off-by: Gert Doering --- M CMakeLists.txt M config.h.cmake.in M src/openvpn/route.c M src/openvpn/tun.c 4 files changed, 18 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/58/458/2 diff --git a/CMakeLists.txt b/CMakeLists.txt index db9966b..e4de309 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,11 +121,17 @@ set(TARGET_FREEBSD YES) set(ENABLE_DCO YES) link_libraries(-lnv) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") + set(TARGET_SOLARIS YES) + set(HAVE_SYS_SOCKIO_H 1) + link_libraries(-lnsl -lsocket -lresolv) elseif (WIN32) set(ENABLE_DCO YES) elseif (APPLE) set(TARGET_DARWIN YES) set(HAVE_NET_IF_UTUN_H YES) +else() + message(FATAL_ERROR "Unknown system name: \"${CMAKE_SYSTEM_NAME}\"") endif () if (UNIX) diff --git a/config.h.cmake.in b/config.h.cmake.in index 0ef8fe3..2af3810 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -334,7 +334,7 @@ #cmakedefine HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKIO_H +#cmakedefine HAVE_SYS_SOCKIO_H /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 @@ -438,6 +438,9 @@ /* Are we running on Linux? */ #cmakedefine TARGET_LINUX +/* Are we running on Solaris/OpenIndiana? */ +#cmakedefine TARGET_SOLARIS + /* Are we running WIN32? */ #cmakedefine TARGET_WIN32 diff --git a/src/openvpn/route.c b/src/openvpn/route.c index ff64938..6cc112c 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -2342,12 +2342,11 @@ return; } -#ifndef _WIN32 +#if !defined(_WIN32) #if !defined(TARGET_LINUX) const char *gateway; -#else - int metric; #endif +#if !defined(TARGET_SOLARIS) bool gateway_needed =3D false; const char *device =3D tt->actual_name; if (r6->iface !=3D NULL) /* vpn server special route */ @@ -2365,6 +2364,7 @@ gateway_needed =3D true; } #endif +#endif struct gc_arena gc =3D gc_new(); struct argv argv =3D argv_new(); @@ -2395,7 +2395,7 @@ msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits ); #if defined(TARGET_LINUX) - metric =3D -1; + int metric =3D -1; if ((r6->flags & RT_METRIC_DEFINED) && (r6->metric > 0)) { metric =3D r6->metric; diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 82ab6c0..f1b8699 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1900,7 +1900,7 @@ #endif -#if !(defined(_WIN32) || defined(TARGET_LINUX)) +#if !(defined(_WIN32) || defined(TARGET_LINUX) || defined(TARGET_SOLARIS)) static void open_tun_generic(const char *dev, const char *dev_type, const char *dev_no= de, struct tuntap *tt) @@ -2061,7 +2061,7 @@ } #endif /* TARGET_LINUX || TARGET_FREEBSD*/ -#if !defined(_WIN32) +#if !(defined(_WIN32) || defined(TARGET_SOLARIS)) static void close_tun_generic(struct tuntap *tt) { @@ -2398,13 +2398,12 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, stru= ct tuntap *tt, openvpn_net_ctx_t *ctx) { - int if_fd, ip_muxid, arp_muxid, arp_fd, ppa =3D -1; + int if_fd =3D -1, ip_muxid =3D -1, arp_muxid =3D -1, arp_fd =3D -1, pp= a =3D -1; struct lifreq ifr; const char *ptr; - const char *ip_node, *arp_node; + const char *ip_node =3D NULL, *arp_node =3D NULL; const char *dev_tuntap_type; int link_type; - bool is_tun; struct strioctl strioc_if, strioc_ppa; /* improved generic TUN/TAP driver from @@ -2428,7 +2427,6 @@ } dev_tuntap_type =3D "tun"; link_type =3D I_PLINK; - is_tun =3D true; } else if (tt->type =3D=3D DEV_TYPE_TAP) { @@ -2440,7 +2438,6 @@ arp_node =3D dev_node; dev_tuntap_type =3D "tap"; link_type =3D I_PLINK; /* was: I_LINK */ - is_tun =3D false; } else { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/458?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I66e3dd7b7166459526824fe5ae81a449b375b8db Gerrit-Change-Number: 458 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --9umcKYCy4RQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #2 to the change originally cr= eated by plaisthos.

View Change

The following approvals got outdated= and were removed: Code-Review+2 by flichtenheld

Minimal Solaris/OpenIndiana support to Cmake =
and clean up -Werror

Change-Id: I66e3dd7b7166459526824fe5ae81a449b37= 5b8db
Signed-off-by: Arne Schwabe <arne@...1227...>
Acked-by: F= rank Lichtenheld <frank@...2641...>
Message-Id: <20231128111447= .64445-1-frank@...2641...>
URL: https://www.mail-archive.com/openvpn-= devel@lists.sourceforge.net/msg27581.html
Signed-off-by: Gert Doering &l= t;gert@...1296...>
---
M CMakeLists.txt
M config.h.cmake.in
= M src/openvpn/route.c
M src/openvpn/tun.c
4 files changed, 18 inserti= ons(+), 12 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/o=
penvpn refs/changes/58/458/2
diff --git a/CMakeLists.txt b/CMakeLis=
ts.txt
index db9966b..e4de309 100644
--- a/= CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121= ,11 +121,17 @@
set(TARGET_FREEBSD YES)
set(ENABLE_DCO YES)
link_libraries(-lnv)<= br>+elseif (${CMAKE_SYSTEM_NAME= } STREQUAL "SunOS")
+ set(TARGET_SOLARIS YES)
+ set(HAVE_SYS_SOCKIO_H 1)
+ link_libraries(-lnsl -lsocket -lresolv)
elseif (WIN32)
set(ENABLE_DCO YES)=
elseif (APPLE)
set(TARGET_DARWIN YES)

set(HAVE_NET_IF_UTUN_H YES)
+else()
+ message(FATAL_ERROR "Unknown system name: \"${CMAK= E_SYSTEM_NAME}\"")
endif ()

if (UNIX)
diff --git a/config.h.cmake.in b/c= onfig.h.cmake.in
index 0ef8fe3..2af3810 100644
--- a/config.h.cmake.in

+++ b/config.h.cmake.in<= br>@@ -334,7 +334,7 @@
#cmakedefine HAVE_SYS_SOCKET_= H

/* Define to 1 if you have the <sys= /sockio.h> header file. */
-#undef HAVE_SYS_SOCKIO_H
+#cmakedefine HAVE_SYS_SOCKIO_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
@@ -438,6 +438,9 @@
/* Are we running on Linux? */
#cmakedefin= e TARGET_LINUX

+/* Are we running on Solaris/OpenIndiana? */
+#cmakedefine TARGET_SOLARIS+
/* Are we r= unning WIN32? */
#cmakedefine TARGET_WIN32

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index ff64938..6cc112c 100644
--- a/src/open= vpn/route.c
+++ b/src/openvpn/route.c
@@ -2= 342,12 +2342,11 @@
return;
}<= /span>

-#ifn= def _WIN32
+#if !defi= ned(_WIN32)
#if !defined(TARGET_LINUX)
= const char *gateway;
= -#else
- int metric;=
#endif
+#if !defined(TARGET_SOLARIS)
bool gateway_needed = =3D false;
const char *device =3D tt->actual_name;<= /span>
if (r6->iface !=3D NULL) /* vpn server= special route */
@@ -2365,6 +2364,7 @@
= gateway_needed =3D true;
}
#end= if
+#endif
=
struct gc_arena gc =3D gc_new();
struct argv argv =3D argv_new();

@@ -2395,7 +2395,7= @@
msg( M_INFO, "delete_route_ipv6(%s/%d)",= network, r6->netbits );

#if defined(= TARGET_LINUX)
- metr= ic =3D -1;
+ int m= etric =3D -1;
if ((r6->flags & RT_METRIC_DEFINE= D) && (r6->metric > 0))
{
metric =3D r6->metric;

diff --git a/src/openv= pn/tun.c b/src/openvpn/tun.c
index 82ab6c0..f1b8699 100644<= /span>
--- a/src/openvpn/tun.c
+++ b/src/openvpn/t= un.c
@@ -1900,7 +1900,7 @@
#endif

-#if !(defined(_WIN32) || defined(TARGET_LINUX))
+#if !(defined(_WIN32) || defined(TARGET_L= INUX) || defined(TARGET_SOLARIS))
static void
open_tun_generic(const char *dev, const char *dev_type, const char *de= v_node,

struct tuntap *tt)
@@ -2061,7 +2061,7 @@

}
#endif /* TARGE= T_LINUX || TARGET_FREEBSD*/

-#if !defined(_WIN32)
+#if !(defined(_WIN32) || defined(TARGET_SOLARIS))<= /span>
static void
close_tun_generic(struct tunt= ap *tt)
{
@@ -2398,13 +2398,12 @@ open_tun(const char *dev, const char *dev_type, const char *dev_no= de, struct tuntap *tt,
openvpn_net_ctx_t *ctx)
{
- i= nt if_fd, ip_muxid, arp_muxid, arp_fd, ppa =3D -1;
+ int if_fd =3D -1, ip_muxid =3D -1, arp_m= uxid =3D -1, arp_fd =3D -1, ppa =3D -1;
struct lifreq = ifr;
const char *ptr;
- const char *ip_node, *arp_node;
+ const char *ip_node =3D NULL, *arp= _node =3D NULL;
const char *dev_tuntap_type; int link_type;
- bool is_tun;
struct strioctl strioc_if, strio= c_ppa;

/* improved generic TUN/TAP d= river from
@@ -2428,7 +2427,6 @@
}=
dev_tuntap_type =3D "tun";
link_type =3D I_PLINK;

- is_tun =3D true;
}
else if (tt->type =3D=3D DEV_TYPE_TAP)

{
@@ -2440,7 +2438,6 @@
arp_node =3D d= ev_node;
dev_tuntap_type =3D "tap";
link_type =3D I_PLINK; /* was: I_LINK */
- is_tun =3D false;
}
else
{

To view, visit change 458. To unsubscribe, or for help w= riting mail filters, visit s= ettings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I66e3dd7b7166459526824fe5ae8= 1a449b375b8db
Gerrit-Change-Number: 458
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--9umcKYCy4RQ=--