summaryrefslogtreecommitdiffstats
path: root/ui/vnc-enc-zrle.c
diff options
context:
space:
mode:
authorAndrew Deason2022-04-26 21:55:23 +0200
committerMarc-André Lureau2022-05-04 10:00:46 +0200
commitaec0730ea9a150f23a5a2bbb87903a2900e5e72f (patch)
tree463c8d13b29d42d685bd2e4d314a3c02c0729ba0 /ui/vnc-enc-zrle.c
parentqga/commands-posix: Use getifaddrs when available (diff)
downloadqemu-aec0730ea9a150f23a5a2bbb87903a2900e5e72f.tar.gz
qemu-aec0730ea9a150f23a5a2bbb87903a2900e5e72f.tar.xz
qemu-aec0730ea9a150f23a5a2bbb87903a2900e5e72f.zip
qga/commands-posix: Fix iface hw address detection
Since its introduction in commit 3424fc9f16a1 ("qemu-ga: add guest-network-get-interfaces command"), guest-network-get-interfaces seems to check if a given interface has a hardware address by checking 'ifa->ifa_flags & SIOCGIFHWADDR'. But ifa_flags is a field for IFF_* flags (IFF_UP, IFF_LOOPBACK, etc), and comparing it to an ioctl like SIOCGIFHWADDR doesn't make sense. On Linux, this isn't a big deal, since SIOCGIFHWADDR has so many bits set (0x8927), 'ifa->ifa_flags & SIOCGIFHWADDR' will usually have a nonzero result for any 'normal'-looking interfaces: anything with IFF_UP (0x1) or IFF_BROADCAST (0x2) set, as well as several less-common flags. This means we'll try to get the hardware address for most/all interfaces, even those that don't really have one (like the loopback device). For those interfaces, Linux just returns a hardware address of all zeroes. On Solaris, however, trying to get the hardware address for a loopback device returns an EADDRNOTAVAIL error. This causes us to return an error and the entire guest-network-get-interfaces call fails. Change this logic to always try to get the hardware address for each interface, and don't return an error if we fail to get it. Instead, just don't include the 'hardware-address' field in the result if we can't get the hardware address. Signed-off-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Message-Id: <20220426195526.7699-3-adeason@sinenomine.net>
Diffstat (limited to 'ui/vnc-enc-zrle.c')
0 files changed, 0 insertions, 0 deletions