提交 c4d19a8e 编写于 作者: C Cédric Bosdonnat 提交者: Cole Robinson

virNetDevIPCheckIPv6ForwardingCallback fixes

Add check for more than one RTA_OIF, even though this is rather
unlikely.

Get rid of the buggy switch / break as this code won't need to
handle more attributes.

Use VIR_WARNINGS_NO_CAST_ALIGN to fix impossible to fix
util/virnetdevip.c:560:17: error: cast increases required alignment of target type [-Werror=cast-align]

(cherry picked from commit b202c39a)
上级 9d9fad96
......@@ -556,15 +556,24 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct nlmsghdr *resp,
if (resp->nlmsg_type != RTM_NEWROUTE)
return ret;
/* Extract a few attributes */
/* Extract a device ID attribute */
VIR_WARNINGS_NO_CAST_ALIGN
for (rta = RTM_RTA(rtmsg); RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
switch (rta->rta_type) {
case RTA_OIF:
VIR_WARNINGS_RESET
if (rta->rta_type == RTA_OIF) {
oif = *(int *)RTA_DATA(rta);
/* Should never happen: netlink message would be broken */
if (ifname) {
char *ifname2 = virNetDevGetName(oif);
VIR_WARN("Single route has unexpected 2nd interface "
"- '%s' and '%s'", ifname, ifname2);
VIR_FREE(ifname2);
break;
}
if (!(ifname = virNetDevGetName(oif)))
goto error;
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册