]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix tcp fastopen failure when disabled, try normal connect instead.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 1 Sep 2021 14:21:10 +0000 (16:21 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 1 Sep 2021 14:21:10 +0000 (16:21 +0200)
doc/Changelog
util/netevent.c

index 2758e9c5223ec9e180eb003c630b922e0e319fa0..8f1c851c7fc6ba2ba942fa95c4b7a9eef41027c6 100644 (file)
@@ -1,3 +1,6 @@
+1 September 2021: Wouter
+       - Fix tcp fastopen failure when disabled, try normal connect instead.
+
 27 August 2021: Wouter
        - Fix #533: Negative responses get cached even when setting
          cache-max-negative-ttl: 1
index e3eed838f278dc551db87d56426edc59bcd8fd9d..9a3b210b28e1a021362e086915b5e4b89ed0076d 100644 (file)
@@ -1863,13 +1863,22 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
                        if(errno == EINTR || errno == EAGAIN)
                                return 1;
                        /* Not handling EISCONN here as shouldn't ever hit that case.*/
-                       if(errno != EPIPE && errno != 0 && verbosity < 2)
-                               return 0; /* silence lots of chatter in the logs */
-                       if(errno != EPIPE && errno != 0) {
+                       if(errno != EPIPE
+#ifdef EOPNOTSUPP
+                               /* if /proc/sys/net/ipv4/tcp_fastopen is
+                                * disabled on Linux, sendmsg may return
+                                * 'Operation not supported', if so
+                                * fallthrough to ordinary connect. */
+                               && errno != EOPNOTSUPP
+#endif
+                               && errno != 0) {
+                               if(verbosity < 2)
+                                       return 0; /* silence lots of chatter in the logs */
                                log_err_addr("tcp sendmsg", strerror(errno),
                                        &c->repinfo.addr, c->repinfo.addrlen);
                                return 0;
                        }
+                       verbose(VERB_ALGO, "tcp sendmsg for fastopen failed (with %s), try normal connect", strerror(errno));
                        /* fallthrough to nonFASTOPEN
                         * (MSG_FASTOPEN on Linux 3 produces EPIPE)
                         * we need to perform connect() */