src: conditionalize use of net/if.h

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>
This commit is contained in:
Daniel P. Berrangé 2020-01-22 11:48:45 +00:00
parent 2b45f453a3
commit 7f3eb533f4
7 changed files with 14 additions and 6 deletions

View 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]|$$

View 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 \

View File

@ -34,7 +34,6 @@
#ifndef WIN32
# include <sys/ioctl.h>
#endif
#include <net/if.h>
#include <fcntl.h>
#ifdef __linux__

View 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"

View 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__

View 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__

View 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 */