Hi Andreas,

It is performing the fallthrough, but writev is also reporting an issue.
 That I attempt to fix in the patch below, that should attempt a
connect() after the failed fastopen, before calling write.  Use this
patch on code that has the previous patch applied.

Best regards, Wouter


On 31/05/17 18:40, A. Schulze via Unbound-users wrote:
> 
> 
> Am 31.05.2017 um 14:15 schrieb A. Schulze via Unbound-users:
> 
>>> Below is a patch, but I don't know if it works, it makes the code 
>>> fallthrough
>>> to try normal TCP writes when FASTOPEN writes fail.
>>
>> I'll try the patch and report results...
> 
> compiled and installed but no change.
> 
> ...
> 2017-05-31 18:36:16.868823500 [1496248576] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2001:310:6000:f::1fc7:1
> 2017-05-31 18:36:16.874287500 [1496248576] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:161:3ec::53
> 2017-05-31 18:36:17.143379500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 203.137.119.119
> 2017-05-31 18:36:17.405554500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 203.137.119.119
> 2017-05-31 18:36:17.411117500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:161:3ec::53
> 2017-05-31 18:36:17.416440500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:150:1095::53
> 2017-05-31 18:36:17.422345500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:150:1095::53
> 2017-05-31 18:36:17.422347500 [1496248577] unbound[22766:0] info: Missing 
> DNSKEY RRset in response to DNSKEY query.
> 2017-05-31 18:36:17.422348500 [1496248577] unbound[22766:0] info: Missing 
> DNSKEY RRset in response to DNSKEY query.
> 2017-05-31 18:36:17.422349500 [1496248577] unbound[22766:0] info: Missing 
> DNSKEY RRset in response to DNSKEY query.
> 2017-05-31 18:36:17.422351500 [1496248577] unbound[22766:0] info: Missing 
> DNSKEY RRset in response to DNSKEY query.
> 2017-05-31 18:36:17.422360500 [1496248577] unbound[22766:0] info: Missing 
> DNSKEY RRset in response to DNSKEY query.
> 2017-05-31 18:36:17.422361500 [1496248577] unbound[22766:0] info: Missing 
> DNSKEY RRset in response to DNSKEY query.
> 2017-05-31 18:36:17.422363500 [1496248577] unbound[22766:0] info: Could not 
> establish a chain of trust to keys for kernel-error.com. DNSKEY IN
> 2017-05-31 18:36:17.422364500 [1496248577] unbound[22766:0] info: validation 
> failure <kernel-error.com. MX IN>: No DNSKEY record for key kernel-error.com. 
> while building chain of trust
> 2017-05-31 18:36:17.422368500 [1496248577] unbound[22766:0] info: ::1 
> kernel-error.com. MX IN SERVFAIL 16.122824 0 34
> 2017-05-31 18:36:17.422369500 [1496248577] unbound[22766:0] info: Could not 
> establish a chain of trust to keys for kernel-error.com. DNSKEY IN
> 2017-05-31 18:36:17.422376500 [1496248577] unbound[22766:0] info: validation 
> failure <kernel-error.com. MX IN>: No DNSKEY record for key kernel-error.com. 
> while building chain of trust
> 2017-05-31 18:36:17.422378500 [1496248577] unbound[22766:0] info: ::1 
> kernel-error.com. MX IN SERVFAIL 16.979449 0 34
> 2017-05-31 18:36:17.422379500 [1496248577] unbound[22766:0] info: resolving 
> kernel-error.com. DNSKEY IN
> 2017-05-31 18:36:17.671634500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2001:310:6000:f::1fc7:1
> 2017-05-31 18:36:17.677029500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:150:1095::53
> 2017-05-31 18:36:17.682693500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:161:3ec::53
> 2017-05-31 18:36:17.682694500 [1496248577] unbound[22766:0] info: Capsforid: 
> timeouts, starting fallback
> 2017-05-31 18:36:17.687988500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:150:1095::53
> 2017-05-31 18:36:17.693575500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 176.9.109.53
> 2017-05-31 18:36:17.699173500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 176.9.109.53
> 2017-05-31 18:36:17.704899500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:161:3ec::53
> 2017-05-31 18:36:17.710267500 [1496248577] unbound[22766:0] error: tcp 
> writev: Broken pipe for 2a01:4f8:161:3ec::53
> ...
> 
> I just also set "use-caps-for-id: no" to exclude that but (this time 
> expected) no change.
> 
> Andreas
> 

Index: util/netevent.c
===================================================================
--- util/netevent.c	(revision 4202)
+++ util/netevent.c	(revision 4203)
@@ -1415,7 +1415,26 @@
 				return 0;
 			}
 			/* fallthrough to nonFASTOPEN
-			 * (MSG_FASTOPEN on Linux 3 produces EPIPE) */
+			 * (MSG_FASTOPEN on Linux 3 produces EPIPE)
+			 * we need to perform connect() */
+			if(connect(fd, &c->repinfo.addr, c->repinfo.addrlen) == -1) {
+#ifdef EINPROGRESS
+				if(errno == EINPROGRESS)
+					return 1; /* wait until connect done*/
+#endif
+#ifdef USE_WINSOCK
+				if(WSAGetLastError() == WSAEINPROGRESS ||
+					WSAGetLastError() == WSAEWOULDBLOCK)
+					return 1; /* wait until connect done*/
+#endif
+				if(tcp_connect_errno_needs_log(
+					&c->repinfo.addr, c->repinfo.addrlen)) {
+					log_err_addr("outgoing tcp: connect after EPIPE for fastopen",
+						strerror(errno), &c->repinfo.addr, c->repinfo.addrlen);
+				}
+				return 0;
+			}
+
 		} else {
 			c->tcp_byte_count += r;
 			if(c->tcp_byte_count < sizeof(uint16_t))

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to