Stephen Borrill wrote:
Hi,
I've been looking at the 2.1 betas and getting excited about the
port-share option. There's numerous caveats about lack of portability
in the source and man page, but I don't know why. sendmsg and recvfrom
have been in BSD since, well, ever, really. NetBSD and FreeBSD have
both had MSG_NOSIGNAL support added (NetBSD very recently in response
to my feedback about OpenVPN), so the only outstanding issue is the
union fdmsg declarationon row 80 of ps.c. On NetBSD (at least)
CMSG_SPACE() isn't static and so can't used in a compile-time context
(it calls a function for CMSG_ALIGN()). Can this be worked around in
OpenVPN to improve portability? Perhaps a static and malloc in the
relevant places in port_share_sendmsg() and
control_message_from_parent()? I guess they don't need to be re-rentrant.
Feel free to port this to BSD. Basically the only aspect of the
port-share implementation which is problematic from a portability
perspective is that it needs the ability to pass an open file descriptor
to another process.
James