diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ee517c13a1..b449293c11 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1532,6 +1532,7 @@ virNetDevSetMTUFromDevice; virNetDevSetName; virNetDevSetNamespace; virNetDevSetOnline; +virNetDevSetupControl; virNetDevValidateConfig; diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 1a22126d1e..7aba515ae3 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -88,12 +88,23 @@ static int virNetDevSetupControlFull(const char *ifname, } -static int virNetDevSetupControl(const char *ifname, - struct ifreq *ifr) +int +virNetDevSetupControl(const char *ifname, + struct ifreq *ifr) { return virNetDevSetupControlFull(ifname, ifr, VIR_NETDEV_FAMILY, SOCK_DGRAM); } -#endif +#else /* !HAVE_STRUCT_IFREQ */ +int +virNetDevSetupControl(const char *ifname ATTRIBUTE_UNUSED, + void *ifr ATTRIBUTE_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("Network device configuration is not supported " + "on this platform")); + return -1; +} +#endif /* HAVE_STRUCT_IFREQ */ #if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ) diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h index bc0777ceb1..933a9b334c 100644 --- a/src/util/virnetdev.h +++ b/src/util/virnetdev.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2012 Red Hat, Inc. + * Copyright (C) 2007-2013 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,11 +23,23 @@ #ifndef __VIR_NETDEV_H__ # define __VIR_NETDEV_H__ +# include + # include "virsocketaddr.h" # include "virnetlink.h" # include "virmacaddr.h" # include "virpci.h" +# ifdef HAVE_STRUCT_IFREQ +typedef struct ifreq virIfreq; +# else +typedef void virIfreq; +# endif + +int virNetDevSetupControl(const char *ifname, + virIfreq *ifr) + ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + int virNetDevExists(const char *brname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;