Mercurial > hg > dhcpcd
changeset 5388:9bb47d579f62 draft
Linux: redefine NLA_ALIGNTO as 4U
This removes the last of the alignment issues reported by clang
in the linux driver for dhcpcd.
Upstream has no interest in fixing this and local testing
shows it works fine on all platforms I have.
https://www.spinics.net/lists/netdev/msg646934.html
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 23 Jun 2020 11:31:25 +0100 |
| parents | 08cbef5c8e9e |
| children | 188a969d672e |
| files | src/if-linux.c |
| diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/if-linux.c Mon Jun 22 22:09:31 2020 +0100 +++ b/src/if-linux.c Tue Jun 23 11:31:25 2020 +0100 @@ -110,7 +110,19 @@ #define SOL_NETLINK 270 #endif -/* Someone should fix kernel headers for clang alignment warnings . */ +/* + * Someone should fix kernel headers for clang alignment warnings. + * But this is unlikely. + * https://www.spinics.net/lists/netdev/msg646934.html + */ + +#undef NLA_ALIGNTO +#undef NLA_ALIGN +#undef NLA_HDRLEN +#define NLA_ALIGNTO 4U +#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) +#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) + #undef IFA_RTA #define IFA_RTA(r) ((struct rtattr *)(void *)(((char *)(r)) \ + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
