Subject: OpenVPN and port sharing - update
To: None <>
From: Stephen Borrill <>
List: tech-net
Date: 05/15/2006 16:27:32
Got OpenVPN 2.1_beta14 working fine from a hacked pkgsrc and tested that 
port sharing with Apache is working.

I made the changes from der Mouse to uipc_syscalls.c to add support for 
MSG_NOSIGNAL and added the relevant line to sys/socket.h too:

#define MSG_NOSIGNAL    0x4000          /* Do not generate SIGPIPE */

I chose the same value as Linux which I guess may help with running under 
Linux emulation (or do we map flags anyway?). As a general point of 
cleanliness, is this the right thing to do or should the next bit (0x400) 
be chosen? FreeBSD use a different value (0x20000).

I then ran into a difference between Linux and NetBSD w.r.t. the 
CMSG_ALIGN macro. On Linux it'll return a static size based on 
sizeof(long). On NetBSD, it calls __cmsg_alignbytes() so is only known at 
runtime. OpenVPN uses it in a global char[] declaration, so on NetBSD it 
fails as it's unknown at compile time. I've hacked it by hand-implementing 
the Linux macros. Anyone think of a better way?

Except for the small issues above, this shows the warnings about only 
running on Linux were bogus.