diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h index ecddebcec..6c0c6844c 100644 --- a/include/haproxy/listener-t.h +++ b/include/haproxy/listener-t.h @@ -95,7 +95,7 @@ enum li_status { /* unused 0x0001 */ /* unused 0x0002 */ /* unused 0x0004 */ -#define LI_O_DEF_ACCEPT 0x0008 /* wait up to 1 second for data before accepting */ +/* unused 0x0008 */ #define LI_O_TCP_L4_RULES 0x0010 /* run TCP L4 rules checks on the incoming connection */ #define LI_O_TCP_L5_RULES 0x0020 /* run TCP L5 rules checks on the incoming session */ /* unused 0x0040 */ @@ -123,6 +123,7 @@ enum li_status { #define BC_O_USE_XPRT_STREAM 0x00000040 /* at least one stream-only xprt listener is used */ #define BC_O_NOLINGER 0x00000080 /* disable lingering on these listeners */ #define BC_O_NOQUICKACK 0x00000100 /* disable quick ack of immediate data (linux) */ +#define BC_O_DEF_ACCEPT 0x00000200 /* wait up to 1 second for data before accepting */ /* flags used with bind_conf->ssl_options */ diff --git a/src/cfgparse-tcp.c b/src/cfgparse-tcp.c index c46a126c7..179f210e6 100644 --- a/src/cfgparse-tcp.c +++ b/src/cfgparse-tcp.c @@ -64,13 +64,7 @@ static int bind_parse_transparent(char **args, int cur_arg, struct proxy *px, st /* parse the "defer-accept" bind keyword */ static int bind_parse_defer_accept(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) { - struct listener *l; - - list_for_each_entry(l, &conf->listeners, by_bind) { - if (l->rx.addr.ss_family == AF_INET || l->rx.addr.ss_family == AF_INET6) - l->options |= LI_O_DEF_ACCEPT; - } - + conf->options |= BC_O_DEF_ACCEPT; return 0; } #endif diff --git a/src/proto_tcp.c b/src/proto_tcp.c index d0850bdb6..662e669db 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -658,7 +658,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) sizeof(zero)); #endif #if defined(TCP_DEFER_ACCEPT) - if (listener->options & LI_O_DEF_ACCEPT) { + if (listener->bind_conf->options & BC_O_DEF_ACCEPT) { /* defer accept by up to one second */ int accept_delay = 1; if (setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &accept_delay, sizeof(accept_delay)) == -1) { @@ -706,7 +706,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) #if !defined(TCP_DEFER_ACCEPT) && defined(SO_ACCEPTFILTER) /* the socket needs to listen first */ - if (listener->options & LI_O_DEF_ACCEPT) { + if (listener->bind_conf->options & BC_O_DEF_ACCEPT) { struct accept_filter_arg accept; memset(&accept, 0, sizeof(accept)); strcpy(accept.af_name, "dataready");