diff options
author | Petr Vorel <petr.vorel@gmail.com> | 2019-06-09 22:57:21 +0200 |
---|---|---|
committer | Sami Kerola <kerolasa@iki.fi> | 2019-06-10 21:17:30 +0100 |
commit | 45257ac4ad8a68763a3699b2d47555b5cf279452 (patch) | |
tree | 7a1c579e78ccbafc8b657c59fa24efc51d441355 | |
parent | 81d0f03d53138b3e100f60a50da50ec946ca866c (diff) | |
download | iputils-45257ac4ad8a68763a3699b2d47555b5cf279452.tar.gz |
common: move various fallback definitions into iputils_common.h
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
-rw-r--r-- | arping.c | 9 | ||||
-rw-r--r-- | iputils_common.h | 25 | ||||
-rw-r--r-- | ping.h | 10 | ||||
-rw-r--r-- | tracepath.c | 17 | ||||
-rw-r--r-- | traceroute6.c | 7 |
5 files changed, 25 insertions, 43 deletions
@@ -37,15 +37,6 @@ #include "iputils_common.h" -#ifdef USE_IDN -# ifndef AI_IDN -# define AI_IDN 0x0040 -# endif -# ifndef AI_CANONIDN -# define AI_CANONIDN 0x0080 -# endif -#endif - #ifdef DEFAULT_DEVICE # define DEFAULT_DEVICE_STR DEFAULT_DEVICE #else diff --git a/iputils_common.h b/iputils_common.h index 977365a..97f9572 100644 --- a/iputils_common.h +++ b/iputils_common.h @@ -24,6 +24,31 @@ # define _(Text) Text #endif +#ifdef USE_IDN +# include <idn2.h> + +# include <netdb.h> +# ifndef AI_IDN +# define AI_IDN 0x0040 +# endif +# ifndef AI_CANONIDN +# define AI_CANONIDN 0x0080 +# endif +# ifndef NI_IDN +# define NI_IDN 32 +# endif +#endif /* #ifdef USE_IDN */ + +#ifndef SOL_IPV6 +# define SOL_IPV6 IPPROTO_IPV6 +#endif +#ifndef IP_PMTUDISC_DO +# define IP_PMTUDISC_DO 2 +#endif +#ifndef IPV6_PMTUDISC_DO +# define IPV6_PMTUDISC_DO 2 +#endif + #ifdef HAVE_ERROR_H # include <error.h> #else @@ -38,16 +38,6 @@ #include "iputils_ni.h" #ifdef USE_IDN -# include <idn2.h> -# ifndef AI_IDN -# define AI_IDN 0x0040 -# endif -# ifndef AI_CANONIDN -# define AI_CANONIDN 0x0080 -# endif -# ifndef NI_IDN -# define NI_IDN 32 -# endif # define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN) # define getnameinfo_flags NI_IDN #else diff --git a/tracepath.c b/tracepath.c index 645a322..7536c9a 100644 --- a/tracepath.c +++ b/tracepath.c @@ -35,28 +35,11 @@ #include "iputils_common.h" #ifdef USE_IDN -# ifndef AI_IDN -# define AI_IDN 0x0040 -# endif -# ifndef NI_IDN -# define NI_IDN 32 -# endif # define getnameinfo_flags NI_IDN #else # define getnameinfo_flags 0 #endif -#ifndef SOL_IPV6 -# define SOL_IPV6 IPPROTO_IPV6 -#endif - -#ifndef IP_PMTUDISC_DO -# define IP_PMTUDISC_DO 2 -#endif -#ifndef IPV6_PMTUDISC_DO -# define IPV6_PMTUDISC_DO 2 -#endif - enum { MAX_PROBES = 10, diff --git a/traceroute6.c b/traceroute6.c index 6c06972..880425d 100644 --- a/traceroute6.c +++ b/traceroute6.c @@ -254,9 +254,6 @@ #include "iputils_common.h" #ifdef USE_IDN -# ifndef NI_IDN -# define NI_IDN 32 -# endif # define ADDRINFO_IDN_FLAGS AI_IDN # define getnameinfo_flags NI_IDN #else @@ -264,10 +261,6 @@ # define ADDRINFO_IDN_FLAGS 0 #endif -#ifndef SOL_IPV6 -# define SOL_IPV6 IPPROTO_IPV6 -#endif - enum { DEFAULT_PROBES = 3, DEFAULT_HOPS = 30, |