Skip to content

Commit

Permalink
Minimal Solaris/OpenIndiana support to Cmake and clean up -Werror
Browse files Browse the repository at this point in the history
Change-Id: I66e3dd7b7166459526824fe5ae81a449b375b8db
Signed-off-by: Arne Schwabe <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg27581.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
schwabe authored and cron2 committed Dec 2, 2023
1 parent 4d8ee61 commit efbedf2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,17 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
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)
Expand Down
5 changes: 4 additions & 1 deletion config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ don't. */
#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
Expand Down Expand Up @@ -438,6 +438,9 @@ don't. */
/* Are we running on Linux? */
#cmakedefine TARGET_LINUX

/* Are we running on Solaris/OpenIndiana? */
#cmakedefine TARGET_SOLARIS

/* Are we running WIN32? */
#cmakedefine TARGET_WIN32

Expand Down
8 changes: 4 additions & 4 deletions src/openvpn/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2342,12 +2342,11 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
return;
}

#ifndef _WIN32
#if !defined(_WIN32)
#if !defined(TARGET_LINUX)
const char *gateway;
#else
int metric;
#endif
#if !defined(TARGET_SOLARIS)
bool gateway_needed = false;
const char *device = tt->actual_name;
if (r6->iface != NULL) /* vpn server special route */
Expand All @@ -2364,6 +2363,7 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
{
gateway_needed = true;
}
#endif
#endif

struct gc_arena gc = gc_new();
Expand Down Expand Up @@ -2395,7 +2395,7 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits );

#if defined(TARGET_LINUX)
metric = -1;
int metric = -1;
if ((r6->flags & RT_METRIC_DEFINED) && (r6->metric > 0))
{
metric = r6->metric;
Expand Down
11 changes: 4 additions & 7 deletions src/openvpn/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@ tun_dco_enabled(struct tuntap *tt)
#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_node,
struct tuntap *tt)
Expand Down Expand Up @@ -2061,7 +2061,7 @@ open_tun_dco_generic(const char *dev, const char *dev_type,
}
#endif /* TARGET_LINUX || TARGET_FREEBSD*/

#if !defined(_WIN32)
#if !(defined(_WIN32) || defined(TARGET_SOLARIS))
static void
close_tun_generic(struct tuntap *tt)
{
Expand Down Expand Up @@ -2398,13 +2398,12 @@ void
open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt,
openvpn_net_ctx_t *ctx)
{
int if_fd, ip_muxid, arp_muxid, arp_fd, ppa = -1;
int if_fd = -1, ip_muxid = -1, arp_muxid = -1, arp_fd = -1, ppa = -1;
struct lifreq ifr;
const char *ptr;
const char *ip_node, *arp_node;
const char *ip_node = NULL, *arp_node = NULL;
const char *dev_tuntap_type;
int link_type;
bool is_tun;
struct strioctl strioc_if, strioc_ppa;

/* improved generic TUN/TAP driver from
Expand All @@ -2428,7 +2427,6 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
}
dev_tuntap_type = "tun";
link_type = I_PLINK;
is_tun = true;
}
else if (tt->type == DEV_TYPE_TAP)
{
Expand All @@ -2440,7 +2438,6 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
arp_node = dev_node;
dev_tuntap_type = "tap";
link_type = I_PLINK; /* was: I_LINK */
is_tun = false;
}
else
{
Expand Down

0 comments on commit efbedf2

Please sign in to comment.