If if_indextoname is not defined, the whole function using it should
not be defined either. Add stub to fix build on mingw.
Caused by 5dd607059d8a98e04024305ae4afbd038aadbdcd
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
configure.ac | 7 ++++---
src/util/virnetdev.c | 10 ++++++++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index cf50422d5dab..08051d53aa0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,9 +319,10 @@ AC_CHECK_SIZEOF([long])
dnl Availability of various common functions (non-fatal if missing),
dnl and various less common threadsafe functions
AC_CHECK_FUNCS_ONCE([cfmakeraw fallocate geteuid getgid getgrnam_r \
- getmntent_r getpwuid_r getrlimit getuid kill mmap newlocale posix_fallocate \
- posix_memalign prlimit regexec sched_getaffinity setgroups setns \
- setrlimit symlink sysctlbyname getifaddrs sched_setscheduler unshare])
+ getmntent_r getpwuid_r getrlimit getuid if_indextoname kill mmap \
+ newlocale posix_fallocate posix_memalign prlimit regexec \
+ sched_getaffinity setgroups setns setrlimit symlink sysctlbyname \
+ getifaddrs sched_setscheduler unshare])
dnl Availability of various common headers (non-fatal if missing).
AC_CHECK_HEADERS([pwd.h regex.h sys/un.h \
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 47e2b20d56a1..170e34827f12 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -852,6 +852,7 @@ virNetDevGetRcvAllMulti(const char *ifname,
return virNetDevGetIFFlag(ifname, VIR_IFF_ALLMULTI, receive);
}
+#if defined(HAVE_IF_INDEXTONAME)
char *virNetDevGetName(int ifindex)
{
char name[IFNAMSIZ];
@@ -871,6 +872,15 @@ char *virNetDevGetName(int ifindex)
cleanup:
return ifname;
}
+#else
+char *virNetDevGetName(int ifindex)
+{
+ virReportSystemError(ENOSYS,
+ _("Cannot get interface name for index
'%i'"),
+ ifindex);
+ return NULL;
+}
+#endif
/**
* virNetDevGetIndex:
--
2.12.2