mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
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]
This commit is contained in:
parent
deb38c4503
commit
b202c39adc
@ -556,15 +556,24 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct nlmsghdr *resp,
|
|||||||
if (resp->nlmsg_type != RTM_NEWROUTE)
|
if (resp->nlmsg_type != RTM_NEWROUTE)
|
||||||
return ret;
|
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)) {
|
for (rta = RTM_RTA(rtmsg); RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
|
||||||
switch (rta->rta_type) {
|
VIR_WARNINGS_RESET
|
||||||
case RTA_OIF:
|
if (rta->rta_type == RTA_OIF) {
|
||||||
oif = *(int *)RTA_DATA(rta);
|
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)))
|
if (!(ifname = virNetDevGetName(oif)))
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user