[PATCH] Fix build on DragonFly BSD

Aaron LI aly at aaronly.me
Thu Jul 6 01:43:52 PDT 2017


Dear ocserv developers,


Below is a simple patch that fixes the build of "ocserv" on DragonFly
BSD using the FreeBSD port "net/ocserv" (version: 0.11.8).  The
DragonFly BSD is a fork of FreeBSD since 2004, and also uses a patched
version of FreeBSD Ports Collection since several years ago.

------------------------------------------------------
commit 7cbd61ddc4d745d59dc5644c8a9d1c3c1c369b08
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Jul 6 15:56:36 2017 +0800

    Fix build on DragonFly BSD
    
    * With this fix, I can successfully build `ocserv-0.11.8` on DragonFly
      BSD (4.9-DEVELOPMENT) using the `net/ocserv` port from FreeBSD [1]
      without any further modifications.
    
    * I didn't test its functionaliies on DragonFly BSD yet.
    
    [1] https://github.com/freebsd/freebsd-ports/tree/master/net/ocserv

diff --git a/src/tun.c b/src/tun.c
index 7e714094..1ecc5c13 100644
--- a/src/tun.c
+++ b/src/tun.c
@@ -48,13 +48,16 @@
 #include <main.h>
 #include <ccan/list/list.h>
 
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 # include <net/if_var.h>
 # include <netinet/in_var.h>
 #endif
 #if defined(__OpenBSD__)
 # include <netinet6/in6_var.h>
 #endif
+#if defined(__DragonFly__)
+# include <net/tun/if_tun.h>
+#endif
 
 #ifdef __linux__
 
@@ -691,7 +694,7 @@ static void reset_ipv4_addr(struct proc_st *proc)
 
 	if (proc->ipv4 == NULL || proc->ipv4->lip_len == 0)
 		return;
-	
+
 #if defined(SIOCDIFADDR) && !defined(__linux__)
 	fd = socket(AF_INET, SOCK_DGRAM, 0);
 
------------------------------------------------------

I also attached the above patch.


Cheers,
-- 
Aly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fix-build-on-DragonFly-BSD.patch
Type: text/x-patch
Size: 1235 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20170706/98739197/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20170706/98739197/attachment.sig>


More information about the openconnect-devel mailing list