On Tue, Jan 28, 2020 at 05:42:47PM +0100, Pavel Hrdina wrote: > 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@xxxxxxxxxx> > > --- > > 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. Yeah, I find the #ifdefs in the virnetdev*.c files quite scary. I think in many/most/all cases there we'd be better off just doing #ifdef __Linux__ / __freebsd__, instead of testing against countless different probed symbols. > Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|