From: Remi Gacogne Date: Thu, 31 May 2018 14:26:39 +0000 (+0200) Subject: Revert EDNS0Record to a trivial type X-Git-Tag: dnsdist-1.3.1~48^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e55cc962d8ee2666a2d990fd65dad1eb6129043;p=pdns Revert EDNS0Record to a trivial type Adding brace initializers makes it non-trivial, which does not seem like a very good idea for a packed structure. gcc 8.1.0 complains with: ``` warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘struct EDNS0Record’ from an array of ‘uint32_t’ {aka ‘unsigned int’} [-Wclass-memaccess] memcpy(&stuff, &ttl, sizeof(stuff)); ``` --- diff --git a/pdns/dns.hh b/pdns/dns.hh index dff9a80df..bb990dc6a 100644 --- a/pdns/dns.hh +++ b/pdns/dns.hh @@ -134,8 +134,8 @@ struct dnsrecordheader struct EDNS0Record { - uint8_t extRCode{0}, version{0}; - uint16_t extFlags{0}; + uint8_t extRCode, version; + uint16_t extFlags; } GCCPACKATTRIBUTE; static_assert(sizeof(EDNS0Record) == 4, "EDNS0Record size must be 4");