[libvirt] [PATCH 1/2] virnetdev: stub virNetDev{Add, Del}Multi on FreeBSD

Currently, build fails on FreeBSD because its struct ifreq does not have ifr_hwaddr member. In order to fix that, check if this member is present, otherwise fall back to the stub version of the virNetDev{Add,Del}Multi functions. --- configure.ac | 3 ++- src/util/virnetdev.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index f7b02ff..31c5fa2 100644 --- a/configure.ac +++ b/configure.ac @@ -2694,7 +2694,8 @@ AC_SUBST([ws_plugindir]) # Check for Linux vs. BSD ifreq members AC_CHECK_MEMBERS([struct ifreq.ifr_newname, struct ifreq.ifr_ifindex, - struct ifreq.ifr_index], + struct ifreq.ifr_index, + struct ifreq.ifr_hwaddr], [], [], [#include <sys/socket.h> #include <net/if.h> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 127bfb2..ac82a74 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1971,7 +1971,8 @@ virNetDevGetLinkInfo(const char *ifname, #endif /* defined(__linux__) */ -#if defined(SIOCADDMULTI) && defined(HAVE_STRUCT_IFREQ) +#if defined(SIOCADDMULTI) && defined(HAVE_STRUCT_IFREQ) && \ + defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) /** * virNetDevAddMulti: * @ifname: interface name to which to add multicast MAC address @@ -2019,7 +2020,8 @@ int virNetDevAddMulti(const char *ifname ATTRIBUTE_UNUSED, } #endif -#if defined(SIOCDELMULTI) && defined(HAVE_STRUCT_IFREQ) +#if defined(SIOCDELMULTI) && defined(HAVE_STRUCT_IFREQ) && \ + defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) /** * virNetDevDelMulti: * @ifname: interface name from which to delete the multicast MAC address -- 2.0.2

The virGetSCSIHostNumber function return type is int, however its stubbed version returns NULL. That results in a build fail on systems that uses the stubbed version. Fix by using a proper return type. --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 3e7f7a2..1116fda 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -2298,7 +2298,7 @@ virGetSCSIHostNumber(const char *adapter_name ATTRIBUTE_UNUSED, unsigned int *result ATTRIBUTE_UNUSED) { virReportSystemError(ENOSYS, "%s", _("Not supported on this platform")); - return NULL; + return -1; } char * -- 2.0.2

[I realized I only sent this directly Roman - so I'll put it on list too] On 10/29/2014 02:20 PM, Roman Bogorodskiy wrote:
The virGetSCSIHostNumber function return type is int, however its stubbed version returns NULL. That results in a build fail on systems that uses the stubbed version. Fix by using a proper return type. --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK - (me who once again gets bit by cut-n-paste of functions) John
diff --git a/src/util/virutil.c b/src/util/virutil.c index 3e7f7a2..1116fda 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -2298,7 +2298,7 @@ virGetSCSIHostNumber(const char *adapter_name ATTRIBUTE_UNUSED, unsigned int *result ATTRIBUTE_UNUSED) { virReportSystemError(ENOSYS, "%s", _("Not supported on this platform")); - return NULL; + return -1; }
char *

John Ferlan wrote:
On 10/29/2014 02:20 PM, Roman Bogorodskiy wrote:
The virGetSCSIHostNumber function return type is int, however its stubbed version returns NULL. That results in a build fail on systems that uses the stubbed version. Fix by using a proper return type. --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK - (me who once again gets bit by cut-n-paste of functions)
Pushed, thanks! Roman Bogorodskiy

On 10/29/2014 02:20 PM, Roman Bogorodskiy wrote:
Currently, build fails on FreeBSD because its struct ifreq does not have ifr_hwaddr member. In order to fix that, check if this member is present, otherwise fall back to the stub version of the virNetDev{Add,Del}Multi functions. --- configure.ac | 3 ++- src/util/virnetdev.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
Looks reasonable to me and since it fixes the build on FreeBSD... ACK John I know I did these backwards, but both seem safe for freeze too.
diff --git a/configure.ac b/configure.ac index f7b02ff..31c5fa2 100644 --- a/configure.ac +++ b/configure.ac @@ -2694,7 +2694,8 @@ AC_SUBST([ws_plugindir]) # Check for Linux vs. BSD ifreq members AC_CHECK_MEMBERS([struct ifreq.ifr_newname, struct ifreq.ifr_ifindex, - struct ifreq.ifr_index], + struct ifreq.ifr_index, + struct ifreq.ifr_hwaddr], [], [], [#include <sys/socket.h> #include <net/if.h> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 127bfb2..ac82a74 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1971,7 +1971,8 @@ virNetDevGetLinkInfo(const char *ifname, #endif /* defined(__linux__) */
-#if defined(SIOCADDMULTI) && defined(HAVE_STRUCT_IFREQ) +#if defined(SIOCADDMULTI) && defined(HAVE_STRUCT_IFREQ) && \ + defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) /** * virNetDevAddMulti: * @ifname: interface name to which to add multicast MAC address @@ -2019,7 +2020,8 @@ int virNetDevAddMulti(const char *ifname ATTRIBUTE_UNUSED, } #endif
-#if defined(SIOCDELMULTI) && defined(HAVE_STRUCT_IFREQ) +#if defined(SIOCDELMULTI) && defined(HAVE_STRUCT_IFREQ) && \ + defined(HAVE_STRUCT_IFREQ_IFR_HWADDR) /** * virNetDevDelMulti: * @ifname: interface name from which to delete the multicast MAC address

John Ferlan wrote:
On 10/29/2014 02:20 PM, Roman Bogorodskiy wrote:
Currently, build fails on FreeBSD because its struct ifreq does not have ifr_hwaddr member. In order to fix that, check if this member is present, otherwise fall back to the stub version of the virNetDev{Add,Del}Multi functions. --- configure.ac | 3 ++- src/util/virnetdev.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
Looks reasonable to me and since it fixes the build on FreeBSD...
ACK
Pushed, thanks! Roman Bogorodskiy
participants (2)
-
John Ferlan
-
Roman Bogorodskiy