]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Don't pack struct hmsg since we are not able to do unaligned access on some archs.
authorVincent Bernat <bernat@luffy.cx>
Wed, 26 Oct 2011 13:56:07 +0000 (15:56 +0200)
committerVincent Bernat <bernat@luffy.cx>
Wed, 26 Oct 2011 13:56:07 +0000 (15:56 +0200)
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.

CHANGELOG
src/lldpd.h

index 7451b4f161a7649b3a10074410e4de39037b0e82..f95002d054be3ff52c423d291b419fd4af9d0b59 100644 (file)
--- 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:
index e6e619a6f3f17223841368bc93cea44d56e673df..60aef5e968673526ddbe3a988cd768d7f215e30e 100644 (file)
@@ -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