Subject: Re: OpenVPN and port sharing - update
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 05/15/2006 11:32:19
> 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.

That'll work right only on ports where __cmsg_alignbytes is no more
restrictive than sizeof(long).  Even if that's currently all ports, I
wouldn't want to count on it.

> Anyone think of a better way?

Make the global a pointer and allocate it at runtime (with eg malloc).
Unfortunately this is pretty much the only way.

Yes, the CMSG_* stuff is ugly and rather poorly thought out.  Things
like this are examples.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B