blob: ed1fa53efdfd77c6183a1dd1d73fe4bb8aa8f856 [file] [log] [blame]
Willy Tarreau92fb9832007-10-16 17:34:28 +02001/*
2 * UNIX SOCK_STREAM protocol layer (uxst)
3 *
Willy Tarreaueb472682010-05-28 18:46:57 +02004 * Copyright 2000-2010 Willy Tarreau <w@1wt.eu>
Willy Tarreau92fb9832007-10-16 17:34:28 +02005 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <ctype.h>
14#include <errno.h>
Willy Tarreau92fb9832007-10-16 17:34:28 +020015#include <stdio.h>
16#include <stdlib.h>
17#include <string.h>
18#include <syslog.h>
19#include <time.h>
20
Willy Tarreau92fb9832007-10-16 17:34:28 +020021#include <sys/socket.h>
22#include <sys/stat.h>
23#include <sys/types.h>
24#include <sys/un.h>
25
Willy Tarreau4c7e4b72020-05-27 12:58:42 +020026#include <haproxy/api.h>
Willy Tarreau7ea393d2020-06-04 18:02:10 +020027#include <haproxy/connection.h>
Willy Tarreau8d366972020-05-27 16:10:29 +020028#include <haproxy/errors.h>
Willy Tarreaub2551052020-06-09 09:07:15 +020029#include <haproxy/fd.h>
Willy Tarreauf268ee82020-06-04 17:05:57 +020030#include <haproxy/global.h>
Willy Tarreau853b2972020-05-27 18:01:47 +020031#include <haproxy/list.h>
Willy Tarreau213e9902020-06-04 14:58:24 +020032#include <haproxy/listener.h>
Willy Tarreauaeed4a82020-06-04 22:01:04 +020033#include <haproxy/log.h>
Willy Tarreaub2551052020-06-09 09:07:15 +020034#include <haproxy/protocol.h>
Willy Tarreaub9b2fd72020-12-08 14:13:11 +010035#include <haproxy/proto_uxst.h>
Willy Tarreau18b7df72020-08-28 12:07:22 +020036#include <haproxy/sock.h>
Willy Tarreauf1725582020-08-28 15:30:11 +020037#include <haproxy/sock_unix.h>
Willy Tarreaub2551052020-06-09 09:07:15 +020038#include <haproxy/tools.h>
Willy Tarreaud6788052020-05-27 15:59:00 +020039#include <haproxy/version.h>
Willy Tarreau92fb9832007-10-16 17:34:28 +020040
Willy Tarreau92fb9832007-10-16 17:34:28 +020041
Emeric Bruncf20bf12010-10-22 16:06:11 +020042static int uxst_bind_listener(struct listener *listener, char *errmsg, int errlen);
Olivier Houchardfdcb0072019-05-06 18:32:29 +020043static int uxst_connect_server(struct connection *conn, int flags);
Willy Tarreau5ddf1ce2020-09-25 19:27:39 +020044static void uxst_enable_listener(struct listener *listener);
45static void uxst_disable_listener(struct listener *listener);
Willy Tarreaucb66ea62020-09-25 17:12:32 +020046static int uxst_suspend_receiver(struct receiver *rx);
Willy Tarreaudabf2e22007-10-28 21:59:24 +010047
48/* Note: must not be declared <const> as its list will be overwritten */
Willy Tarreaub9b2fd72020-12-08 14:13:11 +010049struct protocol proto_uxst = {
Willy Tarreaub366c9a2020-12-08 14:54:20 +010050 .name = "unix_stream",
51
52 /* connection layer */
Willy Tarreau91b47262022-05-20 16:36:46 +020053 .xprt_type = PROTO_TYPE_STREAM,
Willy Tarreaub366c9a2020-12-08 14:54:20 +010054 .listen = uxst_bind_listener,
55 .enable = uxst_enable_listener,
56 .disable = uxst_disable_listener,
57 .add = default_add_listener,
58 .unbind = default_unbind_listener,
59 .suspend = default_suspend_listener,
Aurelien DARRAGON9c3214c2023-02-06 18:54:57 +010060 .resume = default_resume_listener,
Willy Tarreaub366c9a2020-12-08 14:54:20 +010061 .accept_conn = sock_accept_conn,
Willy Tarreaude471c42020-12-08 15:50:56 +010062 .ctrl_init = sock_conn_ctrl_init,
63 .ctrl_close = sock_conn_ctrl_close,
Willy Tarreaub366c9a2020-12-08 14:54:20 +010064 .connect = uxst_connect_server,
Willy Tarreau427c8462020-12-11 16:19:12 +010065 .drain = sock_drain,
Willy Tarreau472125b2020-12-11 17:02:50 +010066 .check_events = sock_check_events,
67 .ignore_events = sock_ignore_events,
Willy Tarreaub366c9a2020-12-08 14:54:20 +010068
69 /* binding layer */
70 .rx_suspend = uxst_suspend_receiver,
71
72 /* address family */
73 .fam = &proto_fam_unix,
74
75 /* socket layer */
Willy Tarreau337edfd2021-10-27 17:05:36 +020076 .proto_type = PROTO_TYPE_STREAM,
Willy Tarreaub366c9a2020-12-08 14:54:20 +010077 .sock_type = SOCK_STREAM,
78 .sock_prot = 0,
79 .rx_enable = sock_enable,
80 .rx_disable = sock_disable,
81 .rx_unbind = sock_unbind,
82 .rx_listening = sock_accepting_conn,
83 .default_iocb = sock_accept_iocb,
84 .receivers = LIST_HEAD_INIT(proto_uxst.receivers),
85 .nb_receivers = 0,
Willy Tarreaudabf2e22007-10-28 21:59:24 +010086};
87
Willy Tarreaub9b2fd72020-12-08 14:13:11 +010088INITCALL1(STG_REGISTER, protocol_register, &proto_uxst);
Willy Tarreau0108d902018-11-25 19:14:37 +010089
Willy Tarreaudabf2e22007-10-28 21:59:24 +010090/********************************
91 * 1) low-level socket functions
92 ********************************/
93
94
Cyril Bonté1f5848a2010-11-14 17:03:19 +010095/********************************
96 * 2) listener-oriented functions
97 ********************************/
98
Cyril Bonté1f5848a2010-11-14 17:03:19 +010099/* This function creates a UNIX socket associated to the listener. It changes
100 * the state from ASSIGNED to LISTEN. The socket is NOT enabled for polling.
Willy Tarreau8ab505b2013-01-24 01:41:38 +0100101 * The return value is composed from ERR_NONE, ERR_RETRYABLE and ERR_FATAL. It
102 * may return a warning or an error message in <errmsg> if the message is at
103 * most <errlen> bytes long (including '\0'). Note that <errmsg> may be NULL if
104 * <errlen> is also zero.
Willy Tarreau92fb9832007-10-16 17:34:28 +0200105 */
Cyril Bonté1f5848a2010-11-14 17:03:19 +0100106static int uxst_bind_listener(struct listener *listener, char *errmsg, int errlen)
Willy Tarreau92fb9832007-10-16 17:34:28 +0200107{
Willy Tarreaucd5e5ea2020-09-02 17:21:02 +0200108 int fd, err;
109 int ready;
Willy Tarreaucd5e5ea2020-09-02 17:21:02 +0200110 char *msg = NULL;
Willy Tarreau92fb9832007-10-16 17:34:28 +0200111
Willy Tarreau3c5efa22014-07-07 18:36:45 +0200112 err = ERR_NONE;
113
Cyril Bonté1f5848a2010-11-14 17:03:19 +0100114 /* ensure we never return garbage */
Willy Tarreau8ab505b2013-01-24 01:41:38 +0100115 if (errlen)
Cyril Bonté1f5848a2010-11-14 17:03:19 +0100116 *errmsg = 0;
117
118 if (listener->state != LI_ASSIGNED)
119 return ERR_NONE; /* already bound */
Willy Tarreau0b915012020-09-01 10:47:07 +0200120
Willy Tarreauad33acf2020-09-02 18:40:02 +0200121 if (!(listener->rx.flags & RX_F_BOUND)) {
122 msg = "receiving socket not bound";
Aurelien DARRAGONd861dc92023-02-06 18:50:51 +0100123 err |= ERR_FATAL | ERR_ALERT;
Willy Tarreauad33acf2020-09-02 18:40:02 +0200124 goto uxst_return;
Willy Tarreau92fb9832007-10-16 17:34:28 +0200125 }
126
Willy Tarreaucd5e5ea2020-09-02 17:21:02 +0200127 fd = listener->rx.fd;
Willy Tarreau7d053e42020-10-15 09:19:43 +0200128 ready = sock_accepting_conn(&listener->rx) > 0;
Willy Tarreau40aa0702013-03-10 23:51:38 +0100129
Willy Tarreaucd5e5ea2020-09-02 17:21:02 +0200130 if (!ready && /* only listen if not already done by external process */
Willy Tarreaue2711c72019-02-27 15:39:41 +0100131 listen(fd, listener_backlog(listener)) < 0) {
Willy Tarreau3c5efa22014-07-07 18:36:45 +0200132 err |= ERR_FATAL | ERR_ALERT;
Willy Tarreaub40dc942010-11-07 12:10:51 +0100133 msg = "cannot listen to UNIX socket";
Willy Tarreaucd5e5ea2020-09-02 17:21:02 +0200134 goto uxst_close_return;
Willy Tarreau92fb9832007-10-16 17:34:28 +0200135 }
136
Willy Tarreaudabf2e22007-10-28 21:59:24 +0100137 /* the socket is now listening */
Willy Tarreaua37b2442020-09-24 07:23:45 +0200138 listener_set_state(listener, LI_LISTEN);
Willy Tarreau3c5efa22014-07-07 18:36:45 +0200139 return err;
140
Willy Tarreaucd5e5ea2020-09-02 17:21:02 +0200141 uxst_close_return:
Cyril Bonté1f5848a2010-11-14 17:03:19 +0100142 close(fd);
Willy Tarreauad33acf2020-09-02 18:40:02 +0200143 uxst_return:
Willy Tarreau40aa0702013-03-10 23:51:38 +0100144 if (msg && errlen) {
Aurelien DARRAGONde63efb2023-02-06 19:23:40 +0100145 char *path_str;
146
147 path_str = sa2str((struct sockaddr_storage *)&listener->rx.addr, 0, 0);
148 snprintf(errmsg, errlen, "%s for [%s]", msg, ((path_str) ? path_str : ""));
149 ha_free(&path_str);
Willy Tarreau40aa0702013-03-10 23:51:38 +0100150 }
Willy Tarreau3c5efa22014-07-07 18:36:45 +0200151 return err;
Willy Tarreaudabf2e22007-10-28 21:59:24 +0100152}
153
Willy Tarreau5ddf1ce2020-09-25 19:27:39 +0200154/* Enable receipt of incoming connections for listener <l>. The receiver must
Willy Tarreaua4380b22020-11-04 13:59:04 +0100155 * still be valid.
Willy Tarreau5ddf1ce2020-09-25 19:27:39 +0200156 */
157static void uxst_enable_listener(struct listener *l)
158{
Willy Tarreaua4380b22020-11-04 13:59:04 +0100159 fd_want_recv_safe(l->rx.fd);
Willy Tarreau5ddf1ce2020-09-25 19:27:39 +0200160}
161
162/* Disable receipt of incoming connections for listener <l>. The receiver must
Willy Tarreaua4380b22020-11-04 13:59:04 +0100163 * still be valid.
Willy Tarreau5ddf1ce2020-09-25 19:27:39 +0200164 */
165static void uxst_disable_listener(struct listener *l)
166{
Willy Tarreaua4380b22020-11-04 13:59:04 +0100167 fd_stop_recv(l->rx.fd);
Willy Tarreau5ddf1ce2020-09-25 19:27:39 +0200168}
169
Willy Tarreaucb66ea62020-09-25 17:12:32 +0200170/* Suspend a receiver. Returns < 0 in case of failure, 0 if the receiver
Aurelien DARRAGON2338dba2023-02-22 14:34:28 +0100171 * was totally stopped, or > 0 if correctly suspended. For plain unix sockets
172 * we only disable the listener to prevent data from being handled but nothing
173 * more is done since currently it's the new process which handles the renaming.
174 * Abstract sockets are completely unbound and closed so there's no need to stop
175 * the poller.
Willy Tarreaufd0e0082014-07-07 21:07:51 +0200176 */
Willy Tarreaucb66ea62020-09-25 17:12:32 +0200177static int uxst_suspend_receiver(struct receiver *rx)
Willy Tarreaufd0e0082014-07-07 21:07:51 +0200178{
Willy Tarreaucb66ea62020-09-25 17:12:32 +0200179 struct listener *l = LIST_ELEM(rx, struct listener *, rx);
180
Aurelien DARRAGON2338dba2023-02-22 14:34:28 +0100181 if (((struct sockaddr_un *)&rx->addr)->sun_path[0]) {
182 uxst_disable_listener(l);
Willy Tarreaufd0e0082014-07-07 21:07:51 +0200183 return 1;
Aurelien DARRAGON2338dba2023-02-22 14:34:28 +0100184 }
Willy Tarreaufd0e0082014-07-07 21:07:51 +0200185
Christopher Faulet510c0d62018-03-16 10:04:47 +0100186 /* Listener's lock already held. Call lockless version of
187 * unbind_listener. */
Willy Tarreau75c98d12020-10-09 15:55:23 +0200188 do_unbind_listener(l);
Willy Tarreaufd0e0082014-07-07 21:07:51 +0200189 return 0;
190}
191
Willy Tarreau47f48c42014-05-09 22:57:47 +0200192
193/*
194 * This function initiates a UNIX connection establishment to the target assigned
Willy Tarreauca9f5a92019-07-17 16:40:37 +0200195 * to connection <conn> using (si->{target,dst}). The source address is ignored
Willy Tarreau47f48c42014-05-09 22:57:47 +0200196 * and will be selected by the system. conn->target may point either to a valid
197 * server or to a backend, depending on conn->target. Only OBJ_TYPE_PROXY and
198 * OBJ_TYPE_SERVER are supported. The <data> parameter is a boolean indicating
199 * whether there are data waiting for being sent or not, in order to adjust data
200 * write polling and on some platforms. The <delack> argument is ignored.
201 *
202 * Note that a pending send_proxy message accounts for data.
203 *
204 * It can return one of :
Willy Tarreaue7dff022015-04-03 01:14:29 +0200205 * - SF_ERR_NONE if everything's OK
206 * - SF_ERR_SRVTO if there are no more servers
207 * - SF_ERR_SRVCL if the connection was refused by the server
208 * - SF_ERR_PRXCOND if the connection has been limited by the proxy (maxconn)
209 * - SF_ERR_RESOURCE if a system resource is lacking (eg: fd limits, ports, ...)
210 * - SF_ERR_INTERNAL for any other purely internal errors
Tim Düsterhus4896c442016-11-29 02:15:19 +0100211 * Additionally, in the case of SF_ERR_RESOURCE, an emergency log will be emitted.
Willy Tarreau47f48c42014-05-09 22:57:47 +0200212 *
Willy Tarreaue7dff022015-04-03 01:14:29 +0200213 * The connection's fd is inserted only when SF_ERR_NONE is returned, otherwise
Willy Tarreau47f48c42014-05-09 22:57:47 +0200214 * it's invalid and the caller has nothing to do.
215 */
Olivier Houchardfdcb0072019-05-06 18:32:29 +0200216static int uxst_connect_server(struct connection *conn, int flags)
Willy Tarreau47f48c42014-05-09 22:57:47 +0200217{
218 int fd;
219 struct server *srv;
220 struct proxy *be;
221
Willy Tarreau158b6cf2022-05-02 17:45:12 +0200222 BUG_ON(!conn->dst);
223
Willy Tarreau47f48c42014-05-09 22:57:47 +0200224 switch (obj_type(conn->target)) {
225 case OBJ_TYPE_PROXY:
Willy Tarreau88bc8002021-12-06 07:01:02 +0000226 be = __objt_proxy(conn->target);
Willy Tarreau47f48c42014-05-09 22:57:47 +0200227 srv = NULL;
228 break;
229 case OBJ_TYPE_SERVER:
Willy Tarreau88bc8002021-12-06 07:01:02 +0000230 srv = __objt_server(conn->target);
Willy Tarreau47f48c42014-05-09 22:57:47 +0200231 be = srv->proxy;
232 break;
233 default:
234 conn->flags |= CO_FL_ERROR;
Willy Tarreaue7dff022015-04-03 01:14:29 +0200235 return SF_ERR_INTERNAL;
Willy Tarreau47f48c42014-05-09 22:57:47 +0200236 }
237
Willy Tarreau585744b2017-08-24 14:31:19 +0200238 if ((fd = conn->handle.fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
Willy Tarreau47f48c42014-05-09 22:57:47 +0200239 qfprintf(stderr, "Cannot get a server socket.\n");
240
241 if (errno == ENFILE) {
242 conn->err_code = CO_ER_SYS_FDLIM;
243 send_log(be, LOG_EMERG,
Willy Tarreauc5532ac2018-01-29 15:06:04 +0100244 "Proxy %s reached system FD limit (maxsock=%d). Please check system tunables.\n",
245 be->id, global.maxsock);
Willy Tarreau47f48c42014-05-09 22:57:47 +0200246 }
247 else if (errno == EMFILE) {
248 conn->err_code = CO_ER_PROC_FDLIM;
249 send_log(be, LOG_EMERG,
Willy Tarreauc5532ac2018-01-29 15:06:04 +0100250 "Proxy %s reached process FD limit (maxsock=%d). Please check 'ulimit-n' and restart.\n",
251 be->id, global.maxsock);
Willy Tarreau47f48c42014-05-09 22:57:47 +0200252 }
253 else if (errno == ENOBUFS || errno == ENOMEM) {
254 conn->err_code = CO_ER_SYS_MEMLIM;
255 send_log(be, LOG_EMERG,
Willy Tarreauc5532ac2018-01-29 15:06:04 +0100256 "Proxy %s reached system memory limit (maxsock=%d). Please check system tunables.\n",
257 be->id, global.maxsock);
Willy Tarreau47f48c42014-05-09 22:57:47 +0200258 }
259 else if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) {
260 conn->err_code = CO_ER_NOPROTO;
261 }
262 else
263 conn->err_code = CO_ER_SOCK_ERR;
264
265 /* this is a resource error */
266 conn->flags |= CO_FL_ERROR;
Willy Tarreaue7dff022015-04-03 01:14:29 +0200267 return SF_ERR_RESOURCE;
Willy Tarreau47f48c42014-05-09 22:57:47 +0200268 }
269
270 if (fd >= global.maxsock) {
271 /* do not log anything there, it's a normal condition when this option
272 * is used to serialize connections to a server !
273 */
Christopher Faulet767a84b2017-11-24 16:50:31 +0100274 ha_alert("socket(): not enough free sockets. Raise -n argument. Giving up.\n");
Willy Tarreau47f48c42014-05-09 22:57:47 +0200275 close(fd);
276 conn->err_code = CO_ER_CONF_FDLIM;
277 conn->flags |= CO_FL_ERROR;
Willy Tarreaue7dff022015-04-03 01:14:29 +0200278 return SF_ERR_PRXCOND; /* it is a configuration limit */
Willy Tarreau47f48c42014-05-09 22:57:47 +0200279 }
280
Willy Tarreau38247432022-04-26 10:24:14 +0200281 if (fd_set_nonblock(fd) == -1) {
Willy Tarreau47f48c42014-05-09 22:57:47 +0200282 qfprintf(stderr,"Cannot set client socket to non blocking mode.\n");
283 close(fd);
284 conn->err_code = CO_ER_SOCK_ERR;
285 conn->flags |= CO_FL_ERROR;
Willy Tarreaue7dff022015-04-03 01:14:29 +0200286 return SF_ERR_INTERNAL;
Willy Tarreau47f48c42014-05-09 22:57:47 +0200287 }
288
Willy Tarreau38247432022-04-26 10:24:14 +0200289 if (master == 1 && fd_set_cloexec(fd) == -1) {
William Lallemandc03eb012018-11-27 12:02:37 +0100290 ha_alert("Cannot set CLOEXEC on client socket.\n");
291 close(fd);
292 conn->err_code = CO_ER_SOCK_ERR;
293 conn->flags |= CO_FL_ERROR;
294 return SF_ERR_INTERNAL;
295 }
296
Willy Tarreau47f48c42014-05-09 22:57:47 +0200297 if (global.tune.server_sndbuf)
298 setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &global.tune.server_sndbuf, sizeof(global.tune.server_sndbuf));
299
300 if (global.tune.server_rcvbuf)
301 setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &global.tune.server_rcvbuf, sizeof(global.tune.server_rcvbuf));
302
Willy Tarreauca9f5a92019-07-17 16:40:37 +0200303 if (connect(fd, (struct sockaddr *)conn->dst, get_addr_len(conn->dst)) == -1) {
Willy Tarreau94841792017-01-25 14:27:38 +0100304 if (errno == EINPROGRESS || errno == EALREADY) {
Willy Tarreau7bb21532014-05-10 09:48:28 +0200305 conn->flags |= CO_FL_WAIT_L4_CONN;
306 }
Willy Tarreau94841792017-01-25 14:27:38 +0100307 else if (errno == EISCONN) {
308 conn->flags &= ~CO_FL_WAIT_L4_CONN;
309 }
Willy Tarreauacef5e22022-04-25 20:32:15 +0200310 else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRINUSE || errno == EADDRNOTAVAIL) {
Willy Tarreau47f48c42014-05-09 22:57:47 +0200311 char *msg;
Willy Tarreauacef5e22022-04-25 20:32:15 +0200312 if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EADDRNOTAVAIL) {
Lukas Tribus9f256d42016-01-26 20:33:14 +0100313 msg = "can't connect to destination unix socket, check backlog size on the server";
Willy Tarreau47f48c42014-05-09 22:57:47 +0200314 conn->err_code = CO_ER_FREE_PORTS;
315 }
316 else {
317 msg = "local address already in use";
318 conn->err_code = CO_ER_ADDR_INUSE;
319 }
320
321 qfprintf(stderr,"Connect() failed for backend %s: %s.\n", be->id, msg);
322 close(fd);
323 send_log(be, LOG_ERR, "Connect() failed for backend %s: %s.\n", be->id, msg);
324 conn->flags |= CO_FL_ERROR;
Willy Tarreaue7dff022015-04-03 01:14:29 +0200325 return SF_ERR_RESOURCE;
Willy Tarreau47f48c42014-05-09 22:57:47 +0200326 }
327 else if (errno == ETIMEDOUT) {
328 close(fd);
329 conn->err_code = CO_ER_SOCK_ERR;
330 conn->flags |= CO_FL_ERROR;
Willy Tarreaue7dff022015-04-03 01:14:29 +0200331 return SF_ERR_SRVTO;
Willy Tarreau47f48c42014-05-09 22:57:47 +0200332 }
333 else { // (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EACCES || errno == EPERM)
334 close(fd);
335 conn->err_code = CO_ER_SOCK_ERR;
336 conn->flags |= CO_FL_ERROR;
Willy Tarreaue7dff022015-04-03 01:14:29 +0200337 return SF_ERR_SRVCL;
Willy Tarreau47f48c42014-05-09 22:57:47 +0200338 }
339 }
Willy Tarreau7bb21532014-05-10 09:48:28 +0200340 else {
341 /* connect() already succeeded, which is quite usual for unix
Willy Tarreau94841792017-01-25 14:27:38 +0100342 * sockets. Let's avoid a second connect() probe to complete it.
Willy Tarreau7bb21532014-05-10 09:48:28 +0200343 */
344 conn->flags &= ~CO_FL_WAIT_L4_CONN;
Willy Tarreau7bb21532014-05-10 09:48:28 +0200345 }
Willy Tarreau47f48c42014-05-09 22:57:47 +0200346
Willy Tarreau47f48c42014-05-09 22:57:47 +0200347 /* Prepare to send a few handshakes related to the on-wire protocol. */
348 if (conn->send_proxy_ofs)
349 conn->flags |= CO_FL_SEND_PROXY;
350
351 conn_ctrl_init(conn); /* registers the FD */
Willy Tarreaub41a6e92021-04-06 17:49:19 +0200352 HA_ATOMIC_AND(&fdtab[fd].state, ~FD_LINGER_RISK); /* no need to disable lingering */
Willy Tarreau47f48c42014-05-09 22:57:47 +0200353
Willy Tarreau4c69cff2020-03-04 16:38:00 +0100354 if (conn->flags & CO_FL_WAIT_L4_CONN) {
355 fd_want_send(fd);
356 fd_cant_send(fd);
Willy Tarreau8dbd1a22020-07-31 08:59:09 +0200357 fd_cant_recv(fd);
Willy Tarreau4c69cff2020-03-04 16:38:00 +0100358 }
Willy Tarreauccf3f6d2019-09-05 17:05:05 +0200359
Willy Tarreaue7dff022015-04-03 01:14:29 +0200360 return SF_ERR_NONE; /* connection is OK */
Willy Tarreau47f48c42014-05-09 22:57:47 +0200361}
362
Willy Tarreau92fb9832007-10-16 17:34:28 +0200363/*
364 * Local variables:
365 * c-indent-level: 8
366 * c-basic-offset: 8
367 * End:
368 */