Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenBSD Support #141

Closed
ghost opened this issue Jan 4, 2019 · 2 comments
Closed

OpenBSD Support #141

ghost opened this issue Jan 4, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 4, 2019

Running make after autogen.sh and ./configure on OpenBSD 6.4:

make  all-recursive
  CC       libopenconnect_la-gpst.lo

In file included from gpst.c:45:
/usr/include/netinet/ip.h:67: error: field 'ip_src' has incomplete type
/usr/include/netinet/ip.h:67: error: field 'ip_dst' has incomplete type
/usr/include/netinet/ip.h:181: error: field 'ipt_addr' has incomplete type

In file included from gpst.c:46:
/usr/include/netinet/ip_icmp.h:71: error: field 'ih_gwaddr' has incomplete type

Error while executing gcc -DHAVE_CONFIG_H -I. -DLOCALEDIR="/usr/local/share/locale" 
-I/usr/local/include -Wall -Wextra -Wno-missing-field-initializers -Wno-sign-compare
-Wno-unused-parameter -Werror=pointer-to-int-cast -Wdeclaration-after-statement
-Werror-implicit-function-declaration -Wformat-nonliteral -Wformat-security -Winit-self
-Wmissing-declarations -Wmissing-include-dirs -Wnested-externs -Wpointer-arith
-Wwrite-strings -I/usr/local/include -I/usr/local/include/p11-kit-1
-I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include
-I/usr/local/include/p11-kit-1 -I/usr/local/include/pskc -I/usr/local/include
-I/usr/local/include/PCSC -pthread -I/usr/local/include -g -O2
-MT libopenconnect_la-gpst.lo -MD -MP -MF .deps/libopenconnect_la-gpst.Tpo
-c gpst.c -fPIC -DPIC -o .libs/libopenconnect_la-gpst.o

*** Error 1 in . (Makefile:1132 'libopenconnect_la-gpst.lo':
@echo "  CC      " libopenconnect_la-gpst.lo;/usr/bin/libtool --silent --tag=CC...)

*** Error 1 in /usr/local/src/openconnect-dlenski (Makefile:715 'all')

There is net/openconnect (version 7.08) on OpenBSD Ports
which builds successfully without patches.


I could build dlenski/openconnect, and run with --protocol gp successfully on FreeBSD 12 though.

@dlenski
Copy link
Owner

dlenski commented Jan 4, 2019

Hi @w17t

There is net/openconnect (version 7.08) on OpenBSD Ports which builds successfully without patches.

So it turns out that I'm slightly lying when I say in the README that this version has no dependencies beyond the upstream openconnect. Initiating the ESP connection with a GlobalProtect server requires building IP/ICMP ping packets with a vary speshul custom payload, and some header files are needed for it.

I could build dlenski/openconnect, and run with --protocol gp successfully on FreeBSD 12 though.

MacOS support is thanks to #9, FreeBSD support is thanks to #46, and Windows support (woof) was added thanks to #90.

I'm pretty sure OpenBSD requires the same extra header files as FreeBSD. Does this patch do the trick?

diff --git a/gpst.c b/gpst.c
index a9ef565..81927e5 100644
--- a/gpst.c
+++ b/gpst.c
@@ -34,14 +34,16 @@
 #include <lz4.h>
 #endif
 
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#include <netinet/in.h>
-#endif
-
 #ifdef _WIN32
 #include "win32-ipicmp.h"
 #else
+/* The BSDs require these basic headers for netinet/ip.h
+ * (Linux and macOS just #include them within netinet/ip.h)
+ */
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#include <sys/types.h>
+#include <netinet/in.h>
+#endif
 #include <netinet/ip.h>
 #include <netinet/ip_icmp.h>
 #endif

@dlenski
Copy link
Owner

dlenski commented Jan 5, 2019

Confimed that the same headers needed for FreeBSD are also needed for OpenBSD, closing.

@dlenski dlenski closed this as completed Jan 5, 2019
Repository owner locked and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant