From c7c27ba763c613f83c1561e56448b49315c271c5 Mon Sep 17 00:00:00 2001 From: Jackie Huang Date: Wed, 6 Mar 2019 09:36:11 -0500 Subject: [PATCH] Upstream: http://www.mail-archive.com/bug-inetutils@gnu.org/msg02103.html Upstream-Status: Pending Signed-off-by: Jackie Huang --- ping/ping_common.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ping/ping_common.h b/ping/ping_common.h index 65e3e60..3e84db0 100644 --- a/ping/ping_common.h +++ b/ping/ping_common.h @@ -18,10 +18,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see `http://www.gnu.org/licenses/'. */ +#include + #include #include #include +#ifdef HAVE_IPV6 #include +#endif #include #include #include @@ -63,7 +67,12 @@ struct ping_stat want to follow the traditional behaviour of ping. */ #define DEFAULT_PING_COUNT 0 +#ifdef HAVE_IPV6 #define PING_HEADER_LEN (USE_IPV6 ? sizeof (struct icmp6_hdr) : ICMP_MINLEN) +#else +#define PING_HEADER_LEN (ICMP_MINLEN) +#endif + #define PING_TIMING(s) ((s) >= sizeof (struct timeval)) #define PING_DATALEN (64 - PING_HEADER_LEN) /* default data length */ @@ -78,13 +87,20 @@ struct ping_stat #define PING_MIN_USER_INTERVAL (200000/PING_PRECISION) +#ifdef HAVE_IPV6 /* FIXME: Adjust IPv6 case for options and their consumption. */ #define _PING_BUFLEN(p, u) ((u)? ((p)->ping_datalen + sizeof (struct icmp6_hdr)) : \ (MAXIPLEN + (p)->ping_datalen + ICMP_TSLEN)) +#else +#define _PING_BUFLEN(p, u) (MAXIPLEN + (p)->ping_datalen + ICMP_TSLEN) +#endif + +#ifdef HAVE_IPV6 typedef int (*ping_efp6) (int code, void *closure, struct sockaddr_in6 * dest, struct sockaddr_in6 * from, struct icmp6_hdr * icmp, int datalen); +#endif typedef int (*ping_efp) (int code, void *closure, @@ -93,13 +109,17 @@ typedef int (*ping_efp) (int code, struct ip * ip, icmphdr_t * icmp, int datalen); union event { +#ifdef HAVE_IPV6 ping_efp6 handler6; +#endif ping_efp handler; }; union ping_address { struct sockaddr_in ping_sockaddr; +#ifdef HAVE_IPV6 struct sockaddr_in6 ping_sockaddr6; +#endif }; typedef struct ping_data PING;