Add check for more than one RTA_OIF, even though this is rather unlikely and get rid of the buggy switch / break. --- src/util/virnetdevip.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index c9ac6baf7..f5662413a 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -556,15 +556,17 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct nlmsghdr *resp, if (resp->nlmsg_type != RTM_NEWROUTE) return ret; - /* Extract a few attributes */ + /* Extract a device ID attribute */ for (rta = RTM_RTA(rtmsg); RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) { - switch (rta->rta_type) { - case RTA_OIF: + if (rta->rta_type == RTA_OIF) { oif = *(int *)RTA_DATA(rta); + /* Should never happen: netlink message would be broken */ + if (ifname) + goto error; + if (!(ifname = virNetDevGetName(oif))) goto error; - break; } } -- 2.12.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list