[libvirt PATCH v2 19/56] src: conditionalize use of net/if.h

Pavel Hrdina phrdina at redhat.com
Tue Jan 28 16:42:47 UTC 2020


On Tue, Jan 28, 2020 at 01:11:00PM +0000, Daniel P. Berrangé wrote:
> 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.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  build-aux/syntax-check.mk  | 2 +-
>  configure.ac               | 1 +
>  src/util/virnetdev.c       | 1 -
>  src/util/virnetdev.h       | 4 +++-
>  src/util/virnetdevbridge.c | 4 +++-
>  src/util/virnetdevip.c     | 4 +++-
>  src/util/virnetdevtap.c    | 4 +++-
>  7 files changed, 14 insertions(+), 6 deletions(-)

Another mess with ifdefs in our code.  The header net/if.h provides:

    struct ifreq{} which we guard with HAVE_STRUCT_IFREQ,

    if_nametoindex which we guard with HAVE_STRUCT_IFREQ or
        with __linux__ && HAVE_LIBNL or with IFDATA_DRIVERNAME

    if_indextoname which we guard with HAVE_IF_INDEXTONAME

Commit <ccaf0beec84b3f55f5206a71e2f1b768cc58cdda> removed the
HAVE_NET_IF_H guard for net/if.h in favor of the gnulib module which
is essentially reverted by this patch.

I would like to cleanup this ifdef guard mess someday but that is out of
scope of this patch series.  I just wanted to point it out.

Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200128/202fbd49/attachment-0001.sig>


More information about the libvir-list mailing list