CMSG_NXTHDR on Linux is defined as a macro wrapping the __csmg_nxthdr function. The translation to D in core.sys.posix.sys.socket.d has an extern __cmsg_nxthdr() function, which is private. This is "exposed" using an alias, CMSG_NXTHDR. But since the alias doesn't change the protection, so CMSG_NXTHDR is not usable. I'm putting together a pull request for a bunch of CMSG changes & fixes, but I don't know what the right way to fix this part is.
Proposed fix inlcluded in https://github.com/D-Programming-Language/druntime/pull/1034
Per Martin's comments (https://github.com/D-Programming-Language/druntime/pull/1034), this is a compiler bug, not a problem with the code as originally written in druntime. private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc; alias __cmsg_nxthdr CMSG_NXTHDR; CMSG_NXTHDR should have default protection instead of private. In the meantime, PR 1034 has been merged; it uses a one-line function for CMSG_NXTHDR instead of an alias.
Thanks