diff --git a/src/internal.h b/src/internal.h index 69dff41f27..2b8cc0922a 100644 --- a/src/internal.h +++ b/src/internal.h @@ -65,22 +65,6 @@ # include "ignore-value.h" # include "count-leading-zeros.h" -/* On architectures which lack these limits, define them (ie. Cygwin). - * Note that the libvirt code should be robust enough to handle the - * case where actual value is longer than these limits (eg. by setting - * length correctly in second argument to gethostname and by always - * using strncpy instead of strcpy). - */ -# ifndef HOST_NAME_MAX -# define HOST_NAME_MAX 256 -# endif - -# ifndef INET_ADDRSTRLEN -# define INET_ADDRSTRLEN 16 -# endif - -# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" - /* String equality tests, suggested by Jim Meyering. */ # define STREQ(a, b) (strcmp(a, b) == 0) # define STRCASEEQ(a, b) (c_strcasecmp(a, b) == 0) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 938e09d9c3..a85bc71d2f 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -42,6 +42,7 @@ #include "viralloc.h" #include "viruuid.h" #include "vircommand.h" +#include "virsocketaddr.h" #include "libxl_domain.h" #include "libxl_conf.h" #include "libxl_utils.h" diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 702abe18d1..4436e396ff 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -65,6 +65,7 @@ #include "virnetdev.h" #include "virfile.h" #include "viratomic.h" +#include "virsocketaddr.h" #include "virthreadpool.h" #include "configmake.h" #include "virtime.h" diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index 82e20de381..3d809fb075 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -37,6 +37,7 @@ #include "nwfilter_learnipaddr.h" #include "virnetdev.h" #include "datatypes.h" +#include "virsocketaddr.h" #include "virstring.h" #define VIR_FROM_THIS VIR_FROM_NWFILTER diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 73c33d6788..a65c92a262 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -49,6 +49,7 @@ #include "cpu/cpu.h" #include "domain_nwfilter.h" #include "virfile.h" +#include "virsocketaddr.h" #include "virstring.h" #include "viratomic.h" #include "storage_conf.h" diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h index 43a370620e..a0425864d5 100644 --- a/src/util/virsocketaddr.h +++ b/src/util/virsocketaddr.h @@ -32,6 +32,18 @@ # include # endif +/* On architectures which lack these limits, define them (ie. Cygwin). + * Note that the libvirt code should be robust enough to handle the + * case where actual value is longer than these limits (eg. by setting + * length correctly in second argument to gethostname and by always + * using strncpy instead of strcpy). + */ +# ifndef INET_ADDRSTRLEN +# define INET_ADDRSTRLEN 16 +# endif + +# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" + typedef struct { union { struct sockaddr sa; diff --git a/src/util/virutil.c b/src/util/virutil.c index e4de4caec9..e08f9fa4ad 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -581,6 +581,10 @@ char *virIndexToDiskName(int idx, const char *prefix) # define AI_CANONIDN 0 #endif +#ifndef HOST_NAME_MAX +# define HOST_NAME_MAX 256 +#endif + /* Who knew getting a hostname could be so delicate. In Linux (and Unices * in general), many things depend on "hostname" returning a value that will * resolve one way or another. In the modern world where networks frequently diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 0aa1a305dd..c5f11a4fcd 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -31,6 +31,7 @@ #include "domain_conf.h" #include "virtime.h" #include "virhostcpu.h" +#include "virsocketaddr.h" #include "storage/storage_driver.h" #include "vz_sdk.h"