]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
src: conditionalize use of net/if.h
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 22 Jan 2020 11:48:45 +0000 (11:48 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 29 Jan 2020 14:51:40 +0000 (14:51 +0000)
The net/if.h is not portable so we must check for its
existance and avoid using it when missing. Some use
of net/if.h was redundant and could be removed.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
build-aux/syntax-check.mk
configure.ac
src/util/virnetdev.c
src/util/virnetdev.h
src/util/virnetdevbridge.c
src/util/virnetdevip.c
src/util/virnetdevtap.c

index 830b0731e512ac283ef0b4ae3ee386cab4d5cb4b..46f546615f855a0ee36aa29d87f29d24ec9b8b43 100644 (file)
@@ -2338,4 +2338,4 @@ exclude_file_name_regexp--sc_prohibit_backslash_alignment = \
   ^build-aux/syntax-check\.mk$$
 
 exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
-  ^src/util/virfile\.c$$
+  ^src/util/(virfile|virnetdev|virnetdevip)\.[c,h]|$$
index 855654c75dac853359c48eaa0dbf09f8a8513cfe..75df326795c007e47d0c348e086e8d76f63688da 100644 (file)
@@ -381,6 +381,7 @@ AC_CHECK_HEADERS([\
   mntent.h \
   net/ethernet.h \
   netinet/tcp.h \
+  net/if.h \
   pty.h \
   pwd.h \
   stdarg.h \
index b896a7507e83e87d2f3b61f14e6a0214f5dc42bc..094d1ac09b552ca1e71fee9c6a85ba4933c49c6a 100644 (file)
@@ -34,7 +34,6 @@
 #ifndef WIN32
 # include <sys/ioctl.h>
 #endif
-#include <net/if.h>
 #include <fcntl.h>
 
 #ifdef __linux__
index 24b41498ed824b26a46e57a9b72e87ebb371db7a..78e1aa656a7948c0699a426cdae1e182460ebe14 100644 (file)
@@ -18,7 +18,9 @@
 
 #pragma once
 
-#include <net/if.h>
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif
 
 #include "virbitmap.h"
 #include "virsocketaddr.h"
index 5bb533f1f0ce2bd591ca094776c11f9c2b696300..5a0fb5f42fbc8c7e5f330cd955956370b070c3dc 100644 (file)
@@ -31,7 +31,9 @@
 # include <sys/ioctl.h>
 #endif
 #include <sys/socket.h>
-#include <net/if.h>
+#ifdef HAVE_NET_IF
+# include <net/if.h>
+#endif
 #include <netinet/in.h>
 
 #ifdef __linux__
index 5897c4aa76b6c972aee546402fc55cc50d312843..bfb93cf25889baa04cef0a8297b94be38907978c 100644 (file)
@@ -36,7 +36,9 @@
 #ifndef WIN32
 # include <sys/ioctl.h>
 #endif
-#include <net/if.h>
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif
 #include <fcntl.h>
 
 #ifdef __linux__
index 8656e267cbbe19d62dacd106ae8c4d1c84c36a7f..84d91428e7e42ccd6ba0b4490c39c3294595115e 100644 (file)
@@ -36,7 +36,9 @@
 #ifndef WIN32
 # include <sys/ioctl.h>
 #endif
-#include <net/if.h>
+#ifdef HAVE_NET_IF
+# include <net/if.h>
+#endif
 #include <fcntl.h>
 #ifdef __linux__
 # include <linux/if_tun.h>    /* IFF_TUN, IFF_NO_PI */