The code for guest-network-get-interfaces needs a couple of small
adjustments for Solaris:
- The results from SIOCGIFHWADDR are documented as being in ifr_addr,
not ifr_hwaddr (ifr_hwaddr doesn't exist on Solaris).
- The implementation of guest_get_network_stats is Linux-specific, so
hide it under #ifdef CONFIG_LINUX. On non-Linux, we just won't
provide network interface stats.
Signed-off-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <
20220426195526.7699-4-adeason@sinenomine.net>
static int guest_get_network_stats(const char *name,
GuestNetworkInterfaceStat *stats)
{
+#ifdef CONFIG_LINUX
int name_len;
char const *devinfo = "/proc/net/dev";
FILE *fp;
fclose(fp);
g_free(line);
g_debug("/proc/net/dev: Interface '%s' not found", name);
+#endif /* CONFIG_LINUX */
return -1;
}
}
} else {
+#ifdef CONFIG_SOLARIS
+ mac_addr = (unsigned char *) &ifr.ifr_addr.sa_data;
+#else
mac_addr = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
-
+#endif
info->hardware_address =
g_strdup_printf("%02x:%02x:%02x:%02x:%02x:%02x",
(int) mac_addr[0], (int) mac_addr[1],