From: Otto Moerbeek Date: Wed, 26 Jun 2019 09:14:25 +0000 (+0200) Subject: Comment on cmsgbuf_aligned in the proper place. X-Git-Tag: dnsdist-1.4.0-rc1~86^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00692909abaea97fae7b59f30f9509d3f8fa8e63;p=pdns Comment on cmsgbuf_aligned in the proper place. --- diff --git a/pdns/misc.cc b/pdns/misc.cc index 4aedbc11b..2686b0fc4 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -885,8 +885,6 @@ Regex::Regex(const string &expr) // with msgh->msg_controllen, please refer to https://github.com/PowerDNS/pdns/pull/3962 // first. // Note that cmsgbuf should be aligned the same as a struct cmsghdr -// This can be achieved by declaring it as -// union { struct cmsghdr hdr; char buf[CMSG_SPACE(spaceneeded)]; } cmsgbuf; void addCMsgSrcAddr(struct msghdr* msgh, cmsgbuf_aligned* cmsgbuf, const ComboAddress* source, int itfIndex) { struct cmsghdr *cmsg = NULL; diff --git a/pdns/misc.hh b/pdns/misc.hh index 67472bd57..ca327e092 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -516,6 +516,7 @@ private: union ComboAddress; +// An aligned type to hold cmsgbufs. See https://man.openbsd.org/CMSG_DATA typedef union { struct cmsghdr hdr; char buf[256]; } cmsgbuf_aligned; /* itfIndex is an interface index, as returned by if_nametoindex(). 0 means default. */