aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-03-14 19:08:19 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-03-14 20:12:07 +0100
commitadee0adbe676692c3a4a32069d0ccef86cec3c4a (patch)
tree2614cb089a04411855f11900b96a7765d32b2620
parent8823555e48209b397b0def62219f9b25243bde23 (diff)
fixed mingw build caused by an invalid explicit function type cast
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--.gitlab-ci.yml20
-rw-r--r--src/ptunnel.c9
-rw-r--r--src/ptunnel.h7
3 files changed, 32 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d3bb51e..3d615d5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,7 +8,7 @@ before_script:
- test ! -r /etc/debian_version || apt-get -qq update
- test ! -r /etc/debian_version || apt-get install -y git debhelper dpkg-dev build-essential fakeroot flawfinder wget unzip
- test ! -r /etc/debian_version || apt-get install -y libpcap-dev libselinux1-dev
- - test ! -r /etc/debian_version || apt-get install -y binutils-mingw-w64-i686 gcc-mingw-w64 mingw-w64-i686-dev mingw-w64-common clang
+ - test ! -r /etc/debian_version || apt-get install -y binutils-mingw-w64-i686 gcc-mingw-w64 mingw-w64-i686-dev binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev mingw-w64-common clang
- test ! -r /etc/debian_version || apt-get install -y valgrind sudo netcat-openbsd
- test ! -r /etc/debian_version || apt-get install -y autoconf automake dh-autoreconf
- test ! -r /etc/arch-release || pacman -Syu --noconfirm
@@ -74,13 +74,31 @@ build-archlinux:
build-mingw:
script:
+ # print mingw-gcc versions and check if the required define is set
+ - i686-w64-mingw32-gcc --version
+ - i686-w64-mingw32-gcc -dM -E - < /dev/null | grep -E '^#define WIN32 1$'
+ - x86_64-w64-mingw32-gcc --version
+ - x86_64-w64-mingw32-gcc -dM -E - < /dev/null | grep -E '^#define WIN32 1$'
+ # the actual build
- autoreconf -fi
+ # i686-w64-mingw32
- ./configure --enable-option-checking=fatal --prefix=/ --host=i686-w64-mingw32
- mv config.log deploy/config-mingw-i686.log
- make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/i686-w64-mingw32-winpcap)" V=s
+ - make clean
- ./configure --enable-option-checking=fatal --prefix=/ --host=i686-w64-mingw32 --enable-npcap
- mv config.log deploy/config-mingw-i686-npcap.log
- make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/i686-w64-mingw32-npcap)" V=s
+ - make clean
+ # x86-64-w64-mingw32
+ - ./configure --enable-option-checking=fatal --prefix=/ --host=x86_64-w64-mingw32
+ - mv config.log deploy/config-mingw-x86_64.log
+ - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/x86_64-w64-mingw32-winpcap)" V=s
+ - make clean
+ - ./configure --enable-option-checking=fatal --prefix=/ --host=x86_64-w64-mingw32 --enable-npcap
+ - mv config.log deploy/config-mingw-x86_64-npcap.log
+ - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/x86_64-w64-mingw32-npcap)" V=s
+ - make clean
stage: build
artifacts:
paths:
diff --git a/src/ptunnel.c b/src/ptunnel.c
index 5feb34a..0a4ab38 100644
--- a/src/ptunnel.c
+++ b/src/ptunnel.c
@@ -375,7 +375,7 @@ void pt_forwarder(void) {
#ifndef WIN32
if (pthread_create(&pid, 0, pt_proxy, 0) != 0)
#else
- if (0 == (pid = _beginthreadex(0, 0, (unsigned int (__stdcall *)(void *))pt_proxy, 0, 0, 0)))
+ if (0 == (pid = _beginthreadex(0, 0, pt_proxy, 0, 0, 0)))
#endif
{
pt_log(kLog_error, "Couldn't create thread! Dropping incoming connection.\n");
@@ -427,7 +427,12 @@ int pt_create_udp_socket(int port) {
/* pt_proxy: This function does all the client and proxy stuff.
*/
-void* pt_proxy(void *args) {
+#ifndef WIN32
+void * pt_proxy(void *args)
+#else
+unsigned int __stdcall pt_proxy(void *args)
+#endif
+{
(void) args;
fd_set set;
diff --git a/src/ptunnel.h b/src/ptunnel.h
index 2fda8bc..6419eae 100644
--- a/src/ptunnel.h
+++ b/src/ptunnel.h
@@ -142,7 +142,12 @@ typedef struct {
#endif
/* function Prototypes */
-void* pt_proxy(void *args);
+#ifndef WIN32
+void * pt_proxy(void *args);
+#else
+unsigned int __stdcall pt_proxy(void *args);
+#endif
+
#ifdef HAVE_PCAP
void pcap_packet_handler(u_char *refcon, const struct pcap_pkthdr *hdr,
const u_char* pkt);