qemu/qga
Andrew Deason aec0730ea9 qga/commands-posix: Fix iface hw address detection
Since its introduction in commit 3424fc9f16 ("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>
2022-05-04 12:00:46 +04:00
..
installer qga-win/msi: fix missing libstdc++-6 DLL in MSI installer 2021-08-03 07:01:36 -05:00
vss-win32 qga/vss-win32: fix compilation with clang++ 2022-04-05 10:42:06 +02:00
channel-posix.c util: rename qemu_*block() socket functions 2022-05-03 15:53:20 +04:00
channel-win32.c qga: Add spaces around operator 2021-03-16 20:20:37 -05:00
channel.h
commands-common.h qga: move qga_get_host_name() 2022-04-21 17:09:09 +04:00
commands-posix-ssh.c Remove superfluous ERRP_GUARD() 2021-08-26 17:15:28 +02:00
commands-posix.c qga/commands-posix: Fix iface hw address detection 2022-05-04 12:00:46 +04:00
commands-win32.c qga: move qga_get_host_name() 2022-04-21 17:09:09 +04:00
commands.c qga: remove need for QEMU atomic.h 2022-04-21 17:09:09 +04:00
guest-agent-command-state.c
guest-agent-core.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
main.c qga: use fixed-length and GDateTime for log timestamp 2022-04-21 17:37:16 +04:00
meson.build qga: wixl: get path to sysroot from pkg-config as intended 2022-04-28 08:51:57 +02:00
qapi-schema.json qapi: Add spaces after symbol declaration for consistency 2021-10-02 07:33:41 +02:00
service-win32.c
service-win32.h
vss-win32.c
vss-win32.h