forked from pool/iputils
5a893e3005
- Backport iputils-ping-fix-pmtu-for-ipv6.patch from upstream to fix PMTU discovery in ping6. (bsc#1072460) OBS-URL: https://build.opensuse.org/request/show/561856 OBS-URL: https://build.opensuse.org/package/show/network:utilities/iputils?expand=0&rev=59
62 lines
2.0 KiB
Diff
62 lines
2.0 KiB
Diff
commit 41874d564033b071b3ee323c96ee1e6458a2ca50
|
|
Author: Jan Synacek <jsynacek@redhat.com>
|
|
Date: Mon May 15 12:07:59 2017 +0200
|
|
|
|
ping: fix pmtu discovery for ipv6
|
|
|
|
Fixes: #40
|
|
|
|
diff --git ping.c ping.c
|
|
index 0668a18d202f..0c8893d1ec0f 100644
|
|
--- ping.c
|
|
+++ ping.c
|
|
@@ -108,7 +108,7 @@ int cmsg_len;
|
|
|
|
static struct sockaddr_in source = { .sin_family = AF_INET };
|
|
char *device;
|
|
-static int pmtudisc = -1;
|
|
+int pmtudisc = -1;
|
|
|
|
static void create_socket(socket_st *sock, int family, int socktype, int protocol, int requisite)
|
|
{
|
|
@@ -510,8 +510,14 @@ main(int argc, char **argv)
|
|
|
|
if (hints.ai_family != AF_INET6)
|
|
create_socket(&sock4, AF_INET, hints.ai_socktype, IPPROTO_ICMP, hints.ai_family == AF_INET);
|
|
- if (hints.ai_family != AF_INET)
|
|
+ if (hints.ai_family != AF_INET) {
|
|
create_socket(&sock6, AF_INET6, hints.ai_socktype, IPPROTO_ICMPV6, sock4.fd == -1);
|
|
+ /* This may not be needed if both protocol versions always had the same value, but
|
|
+ * since I don't know that, it's better to be safe than sorry. */
|
|
+ pmtudisc = pmtudisc == IP_PMTUDISC_DO ? IPV6_PMTUDISC_DO :
|
|
+ pmtudisc == IP_PMTUDISC_DONT ? IPV6_PMTUDISC_DONT :
|
|
+ pmtudisc == IP_PMTUDISC_WANT ? IPV6_PMTUDISC_WANT : pmtudisc;
|
|
+ }
|
|
disable_capability_raw();
|
|
|
|
/* Limit address family on single-protocol systems */
|
|
diff --git ping.h ping.h
|
|
index 749f3ff86f0b..a0986694dbc2 100644
|
|
--- ping.h
|
|
+++ ping.h
|
|
@@ -168,6 +168,7 @@ extern volatile int status_snapshot;
|
|
extern int confirm;
|
|
extern int confirm_flag;
|
|
extern char *device;
|
|
+extern int pmtudisc;
|
|
|
|
extern volatile int in_pr_addr; /* pr_addr() is executing */
|
|
extern jmp_buf pr_addr_jmp;
|
|
diff --git ping6_common.c ping6_common.c
|
|
index 498e5908f50f..a2a5b230e6e1 100644
|
|
--- ping6_common.c
|
|
+++ ping6_common.c
|
|
@@ -101,7 +101,6 @@ void ping6_usage(unsigned) __attribute((noreturn));
|
|
|
|
struct sockaddr_in6 source6 = { .sin6_family = AF_INET6 };
|
|
char *device;
|
|
-int pmtudisc=-1;
|
|
|
|
#if defined(USE_GCRYPT) || defined(USE_OPENSSL) || defined(USE_NETTLE)
|
|
#include "iputils_md5dig.h"
|