提交 9304d916 编写于 作者: M Michal Privoznik

virarptable: Avoid cast align warnings

We have to use VIR_WARNINGS_NO_CAST_ALIGN to avoid clang warning
about increased required alignment caused by some netlink macros.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 1bc7e2b8
......@@ -51,10 +51,11 @@ static int
parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len)
{
memset(tb, 0, sizeof(struct rtattr *) * (max + 1));
while (RTA_OK(rta, len)) {
VIR_WARNINGS_NO_CAST_ALIGN
for (; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
VIR_WARNINGS_RESET
if ((rta->rta_type <= max) && (!tb[rta->rta_type]))
tb[rta->rta_type] = rta;
rta = RTA_NEXT(rta, len);
}
if (len)
......@@ -82,7 +83,9 @@ virArpTablePtr virArpTableGet(void)
nh = (struct nlmsghdr*)nlData;
while (NLMSG_OK(nh, msglen)) {
VIR_WARNINGS_NO_CAST_ALIGN
for (; NLMSG_OK(nh, msglen); nh = NLMSG_NEXT(nh, msglen)) {
VIR_WARNINGS_RESET
struct ndmsg *r = NLMSG_DATA(nh);
int len = nh->nlmsg_len;
void *addr;
......@@ -94,23 +97,23 @@ virArpTablePtr virArpTableGet(void)
}
if (r->ndm_family && (r->ndm_family != AF_INET))
goto next_nlmsg;
continue;
/* catch stale and reachalbe arp entry only */
if (r->ndm_state &&
(!(r->ndm_state == NUD_STALE || r->ndm_state == NUD_REACHABLE))) {
nh = NLMSG_NEXT(nh, msglen);
(!(r->ndm_state == NUD_STALE || r->ndm_state == NUD_REACHABLE)))
continue;
}
if (nh->nlmsg_type == NLMSG_DONE)
goto end_of_netlink_messages;
VIR_WARNINGS_NO_CAST_ALIGN
parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
VIR_WARNINGS_RESET
if (tb[NDA_DST] == NULL || tb[NDA_LLADDR] == NULL)
goto next_nlmsg;
continue;
if (tb[NDA_DST]) {
virSocketAddr virAddr;
......@@ -146,9 +149,6 @@ virArpTablePtr virArpTableGet(void)
num++;
}
next_nlmsg:
nh = NLMSG_NEXT(nh, msglen);
}
end_of_netlink_messages:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册