From: Vincent Bernat Date: Wed, 26 Oct 2011 13:56:07 +0000 (+0200) Subject: Don't pack struct hmsg since we are not able to do unaligned access on some archs. X-Git-Tag: 0.5.5~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8818344897de5d62146d62ababfb53c47da4765;p=thirdparty%2Flldpd.git Don't pack struct hmsg since we are not able to do unaligned access on some archs. Packing was used because data was cast as a pointer and therefore, header was padded excessively. Since we don't use it as a pointer, we cast it as an incomplete array of chars. We don't need its size. --- diff --git a/CHANGELOG b/CHANGELOG index 7451b4f1..f95002d0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,8 @@ lldpd (0.5.5) interface names. This is fixed but it is preferable to use XML output since the parsing is more difficult in this case. + Only grab DMI information once. Only uses DMI for x86 platform. + + Padding issues with socket protocol. This introduces a change in + the socket protocol! lldpd (0.5.4) * Features: diff --git a/src/lldpd.h b/src/lldpd.h index e6e619a6..60aef5e9 100644 --- a/src/lldpd.h +++ b/src/lldpd.h @@ -400,12 +400,12 @@ struct hmsg_hdr { enum hmsg_type type; int16_t len; pid_t pid; -} __attribute__ ((__packed__)); +}; struct hmsg { struct hmsg_hdr hdr; - void *data; -} __attribute__ ((__packed__)); + char data[]; +}; #define HMSG_HEADER_SIZE sizeof(struct hmsg_hdr) #define MAX_HMSGSIZE 8192