From: Roy Marples Date: Tue, 17 Dec 2019 15:29:53 +0000 (+0000) Subject: Linux: work around alignment isses with clang X-Git-Tag: v9.0.0~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac57030b21e0874deff0615dab0c4f6c1024bbdd;p=thirdparty%2Fdhcpcd.git Linux: work around alignment isses with clang --- diff --git a/src/if-linux.c b/src/if-linux.c index 5b31cada..9203bbfa 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -109,6 +109,24 @@ int if_getssid_wext(const char *ifname, uint8_t *ssid); #define SOL_NETLINK 270 #endif +/* Someone should fix kernel headers for clang alignment warnings . */ +#undef IFA_RTA +#define IFA_RTA(r) ((struct rtattr *)(void *)(((char *)(r)) \ + + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) +#undef IFLA_RTA +#define IFLA_RTA(r) ((struct rtattr *)(void *)(((char *)(r)) \ + + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) +#undef NLMSG_NEXT +#define NLMSG_NEXT(nlh, len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ + (struct nlmsghdr *)(void *)(((char *)(nlh)) \ + + NLMSG_ALIGN((nlh)->nlmsg_len))) +#undef RTM_RTA +#define RTM_RTA(r) (void *)(((char *)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))) +#undef RTA_NEXT +#define RTA_NEXT(rta, attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ + (struct rtattr *)(void *)(((char *)(rta)) \ + + RTA_ALIGN((rta)->rta_len))) + struct priv { int route_fd; uint32_t route_pid;