Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards
On Mon, 3 Aug 2020, Thorsten Glaser wrote:
> keep the code I currently have that compares byte 0 and 3, using
Actually not. I’ve added some debugging code with…
static size_t
cmsg_actual_data_len(const struct cmsghdr *cmsg)
{
union {
const struct cmsghdr *cmsg;
const unsigned char *uc;
} ptr[(
/* compile-time assertions */
sizeof(socklen_t) <= sizeof(size_t)
) ? 1 : -1];
ptrdiff_t pd;
ptr[0].cmsg = cmsg;
pd = CMSG_DATA(cmsg) - ptr[0].uc;
return ((size_t)cmsg->cmsg_len - (size_t)pd);
}
… and dumping the received data on Linux and MidnightBSD
(the two systems I currently have access) and found varying
results but if this returns 4 I think I better consume an int.
bye,
//mirabilos
--
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
Reply to: