Newer
Older
From c63130ac155443677fccddf143cc2c7fc4158e4d Mon Sep 17 00:00:00 2001
Message-Id: <c63130ac155443677fccddf143cc2c7fc4158e4d.1565088614.git.thomas@gllm.fr>
In-Reply-To: <8181eb1f5b872c51879f155318b6218f49b73171.1565088614.git.thomas@gllm.fr>
References: <8181eb1f5b872c51879f155318b6218f49b73171.1565088614.git.thomas@gllm.fr>
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Fri, 29 Mar 2019 10:56:26 +0100
Subject: [PATCH 4/6] network: tls: Handle errors from older kernels
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
If MSG_FASTOPEN is defined, but turns out to be unimplemented by the
underlying kernel (as is the case on android where the NDK claims to
support fast open but some older kernels don't) EPIPE is returned
instead of EOPNOTSUPP.
See net/ipv4/tcp.c:936 & net/core/stream.c:55
sk_stream_wait_connect will return EPIPE if no SYN was sent/received,
and sendmsg will propagate that error.
Treating EPIPE as a synonym for EOPNOTSUPP here allows for the
connection to proceed, and the first call to sendmsg to complete as
expected.
---
src/network/tls.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/network/tls.c b/src/network/tls.c
index 56e04d6ce7..3c3c083c30 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -546,8 +546,11 @@ static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls,
return -1;
}
else
- if (errno != EOPNOTSUPP)
+ if (errno != EOPNOTSUPP && errno != EPIPE)
+ { /* If MSG_FASTOPEN was defined but the kernel doesn't support fast open at
+ all, EPIPE will be returned instead of EOPNOTSUPP */
return -1;
+ }
/* Fast open not supported or disabled... fallback to normal mode */
#else
tls->writev = vlc_tls_SocketWrite;
--
2.20.1