xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-connectivity/inetutils/inetutils/fix-disable-ipv6.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From c7c27ba763c613f83c1561e56448b49315c271c5 Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Wed, 6 Mar 2019 09:36:11 -0500
4Subject: [PATCH] Upstream:
5 http://www.mail-archive.com/bug-inetutils@gnu.org/msg02103.html
6
7Upstream-Status: Pending
8
9Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
10
11---
12 ping/ping_common.h | 20 ++++++++++++++++++++
13 1 file changed, 20 insertions(+)
14
15diff --git a/ping/ping_common.h b/ping/ping_common.h
16index 65e3e60..3e84db0 100644
17--- a/ping/ping_common.h
18+++ b/ping/ping_common.h
19@@ -18,10 +18,14 @@
20   You should have received a copy of the GNU General Public License
21   along with this program.  If not, see `http://www.gnu.org/licenses/'. */
22
23+#include <config.h>
24+
25 #include <netinet/in_systm.h>
26 #include <netinet/in.h>
27 #include <netinet/ip.h>
28+#ifdef HAVE_IPV6
29 #include <netinet/icmp6.h>
30+#endif
31 #include <icmp.h>
32 #include <error.h>
33 #include <progname.h>
34@@ -63,7 +67,12 @@ struct ping_stat
35    want to follow the traditional behaviour of ping.  */
36 #define DEFAULT_PING_COUNT 0
37
38+#ifdef HAVE_IPV6
39 #define PING_HEADER_LEN (USE_IPV6 ? sizeof (struct icmp6_hdr) : ICMP_MINLEN)
40+#else
41+#define PING_HEADER_LEN (ICMP_MINLEN)
42+#endif
43+
44 #define PING_TIMING(s)  ((s) >= sizeof (struct timeval))
45 #define PING_DATALEN    (64 - PING_HEADER_LEN)  /* default data length */
46
47@@ -78,13 +87,20 @@ struct ping_stat
48
49 #define PING_MIN_USER_INTERVAL (200000/PING_PRECISION)
50
51+#ifdef HAVE_IPV6
52 /* FIXME: Adjust IPv6 case for options and their consumption.  */
53 #define _PING_BUFLEN(p, u) ((u)? ((p)->ping_datalen + sizeof (struct icmp6_hdr)) : \
54 				   (MAXIPLEN + (p)->ping_datalen + ICMP_TSLEN))
55
56+#else
57+#define _PING_BUFLEN(p, u) (MAXIPLEN + (p)->ping_datalen + ICMP_TSLEN)
58+#endif
59+
60+#ifdef HAVE_IPV6
61 typedef int (*ping_efp6) (int code, void *closure, struct sockaddr_in6 * dest,
62 			  struct sockaddr_in6 * from, struct icmp6_hdr * icmp,
63 			  int datalen);
64+#endif
65
66 typedef int (*ping_efp) (int code,
67 			 void *closure,
68@@ -93,13 +109,17 @@ typedef int (*ping_efp) (int code,
69 			 struct ip * ip, icmphdr_t * icmp, int datalen);
70
71 union event {
72+#ifdef HAVE_IPV6
73   ping_efp6 handler6;
74+#endif
75   ping_efp handler;
76 };
77
78 union ping_address {
79   struct sockaddr_in ping_sockaddr;
80+#ifdef HAVE_IPV6
81   struct sockaddr_in6 ping_sockaddr6;
82+#endif
83 };
84
85 typedef struct ping_data PING;
86