OpenVPN is an open-source application to securely tunnel IP networks
over a single TCP/UDP port, with support for SSL/TLS-based
session authentication and key exchange,
packet encryption, packet authentication, and
packet compression.
Here's how to compile it on QNX Neutrino:
- Download the OpenVPN source from
http://swupdate.openvpn.org/community/releases/openvpn-2.3.11.tar.gz.
- Untar the file, and then enter the created directory:
tar -zxvf openvpn-2.3.11.tar.gz
cd openvpn-2.3.11
- Create a build-hooks script to set target-specific settings for the
addvariant
tool:
- Add the io-pkt directory to include paths for types_bsd.h.
- Set fork_works to yes for QNX targets.
- Disable auth-pam for QNX targets.
For example:
echo '#!/bin/ksh
function hook_preconfigure {
CPPFLAGS="$CPPFLAGS -I$QNX_TARGET/usr/include/io-pkt"
configure_opts="${configure_opts} --disable-plugin-auth-pam"
configure_opts="${configure_opts} ac_cv_func_fork_works=yes"
}
' > build-hooks
chmod 777 build-hooks
- Add the QNX Neutrino target type to the configure script.
Edit this file, search for the *-*-linux*) line, and add the following
above it:
*-*-qnx*)
$as_echo "#define TARGET_QNXNTO 1" >>confdefs.h
cat >>confdefs.h <<_ACEOF
#define TARGET_PREFIX "Q"
_ACEOF
;;
- Add QNX Neutrino target to the config.h.in file.
This change defines TARGET_NETBSD, so that QNX Neutrino is handled like NetBSD.
Search for Are we running on, and add the following:
/* Are we running on QNX Neutrino? */
#undef TARGET_QNXNTO
#ifdef TARGET_QNXNTO
/* QNX mirrors the NetBSD implementation */
#define TARGET_NETBSD
#endif
- Update the source to include the NetBSD headers;
edit src/openvpn/tun.c, search for PR 32944,
and add the following after #elif defined (TARGET_NETBSD):
#ifdef TARGET_QNXNTO
#include <sys/types_bsd.h>
#endif
- Update IV_PLAT to indicate QNX Neutrino; edit src/openvpn/ssl.c,
search for IV_PLAT=linux, and add the following after that line:
#elif defined(TARGET_QNXNTO)
buf_printf (&out, "IV_PLAT=qnx\n");
- Update the source to use IP_RECVDSTADDR instead of IP_PKTINFO,
because struct in_pktinfo isn't exactly the same as for other targets.
Edit src/openvpn/socket.h, and add the following
after the declaration of struct openvpn_sockaddr:
#ifdef TARGET_QNXNTO
#undef HAVE_IN_PKTINFO
#undef IP_PKTINFO
#endif
- Set up the QNX SDP build environment:
source base_directory/qnxsdp-env.sh
where base_directory is where you installed QNX SDP.
- Add the supported targets:
addvariant nto arm le-v7
addvariant nto x86 o
addvariant nto aarch64 le
addvariant nto x86_64 o
- Build the targets:
make
The binaries are located in the specific directory for each target.
For example, the openvpn binary is placed in the following:
- ./nto-arm-le-v7/src/openvpn/openvpn
- ./nto-x86_64-o/src/openvpn/openvpn
- ./nto-x86-o/src/openvpn/openvpn
- ./nto-aarch64-le/src/openvpn/openvpn