MINOR: protocol: add a new pair of enable/disable methods for listeners

These methods will be used to enable/disable accepting new connections
so that listeners do not play with FD directly anymore. Since all the
currently supported protocols work on socket for now, these are identical
to the rx_enable/rx_disable functions. However they were not defined in
sock.c since it's likely that some will quickly start to differ. At the
moment they're not used.

We have to take care of fd_updt before calling fd_{want,stop}_recv()
because it's allocated fairly late in the boot process and some such
functions may be called very early (e.g. to stop a disabled frontend's
listeners).
diff --git a/include/haproxy/protocol-t.h b/include/haproxy/protocol-t.h
index fbd8419..c5b93ed 100644
--- a/include/haproxy/protocol-t.h
+++ b/include/haproxy/protocol-t.h
@@ -89,6 +89,8 @@
 	/* functions acting on the listener */
 	void (*add)(struct listener *l, int port);      /* add a listener for this protocol and port */
 	int (*listen)(struct listener *l, char *errmsg, int errlen); /* start a listener */
+	void (*enable)(struct listener *l);             /* enable receipt of new connections */
+	void (*disable)(struct listener *l);            /* disable receipt of new connections */
 
 	/* functions acting on the receiver */
 	void (*rx_enable)(struct receiver *rx);         /* enable receiving on the receiver */
diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c
index 4a5701c..f43aa82 100644
--- a/src/proto_sockpair.c
+++ b/src/proto_sockpair.c
@@ -44,6 +44,8 @@
 
 static void sockpair_add_listener(struct listener *listener, int port);
 static int sockpair_bind_listener(struct listener *listener, char *errmsg, int errlen);
+static void sockpair_enable_listener(struct listener *listener);
+static void sockpair_disable_listener(struct listener *listener);
 static int sockpair_connect_server(struct connection *conn, int flags);
 
 struct proto_fam proto_fam_sockpair = {
@@ -68,6 +70,8 @@
 	.sock_prot = 0,
 	.add = sockpair_add_listener,
 	.listen = sockpair_bind_listener,
+	.enable = sockpair_enable_listener,
+	.disable = sockpair_disable_listener,
 	.rx_enable = sock_enable,
 	.rx_disable = sock_disable,
 	.accept = &listener_accept,
@@ -95,6 +99,24 @@
 	proto_sockpair.nb_receivers++;
 }
 
+/* Enable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void sockpair_enable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_want_recv(l->rx.fd);
+}
+
+/* Disable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void sockpair_disable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_stop_recv(l->rx.fd);
+}
+
 /* Binds receiver <rx>, and assigns <handler> and rx->owner as the callback and
  * context, respectively, with <tm> as the thread mask. Returns and error code
  * made of ERR_* bits on failure or ERR_NONE on success. On failure, an error
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 9574c18..b12cf72 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -47,6 +47,8 @@
 static int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen);
 static int tcp_suspend_receiver(struct receiver *rx);
 static int tcp_resume_receiver(struct receiver *rx);
+static void tcp_enable_listener(struct listener *listener);
+static void tcp_disable_listener(struct listener *listener);
 static void tcpv4_add_listener(struct listener *listener, int port);
 static void tcpv6_add_listener(struct listener *listener, int port);
 
@@ -60,6 +62,8 @@
 	.sock_prot = IPPROTO_TCP,
 	.add = tcpv4_add_listener,
 	.listen = tcp_bind_listener,
+	.enable = tcp_enable_listener,
+	.disable = tcp_disable_listener,
 	.rx_enable = sock_enable,
 	.rx_disable = sock_disable,
 	.rx_suspend = tcp_suspend_receiver,
@@ -82,6 +86,8 @@
 	.sock_prot = IPPROTO_TCP,
 	.add = tcpv6_add_listener,
 	.listen = tcp_bind_listener,
+	.enable = tcp_enable_listener,
+	.disable = tcp_disable_listener,
 	.rx_enable = sock_enable,
 	.rx_disable = sock_disable,
 	.rx_suspend = tcp_suspend_receiver,
@@ -733,6 +739,24 @@
 	proto_tcpv6.nb_receivers++;
 }
 
+/* Enable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void tcp_enable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_want_recv(l->rx.fd);
+}
+
+/* Disable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void tcp_disable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_stop_recv(l->rx.fd);
+}
+
 /* Suspend a receiver. Returns < 0 in case of failure, 0 if the receiver
  * was totally stopped, or > 0 if correctly suspended.
  */
diff --git a/src/proto_udp.c b/src/proto_udp.c
index 31db442..33a4dca 100644
--- a/src/proto_udp.c
+++ b/src/proto_udp.c
@@ -42,6 +42,8 @@
 
 static int udp_bind_listener(struct listener *listener, char *errmsg, int errlen);
 static int udp_suspend_receiver(struct receiver *rx);
+static void udp_enable_listener(struct listener *listener);
+static void udp_disable_listener(struct listener *listener);
 static void udp4_add_listener(struct listener *listener, int port);
 static void udp6_add_listener(struct listener *listener, int port);
 
@@ -55,6 +57,8 @@
 	.sock_prot = IPPROTO_UDP,
 	.add = udp4_add_listener,
 	.listen = udp_bind_listener,
+	.enable = udp_enable_listener,
+	.disable = udp_disable_listener,
 	.rx_enable = sock_enable,
 	.rx_disable = sock_disable,
 	.rx_suspend = udp_suspend_receiver,
@@ -74,6 +78,8 @@
 	.sock_prot = IPPROTO_UDP,
 	.add = udp6_add_listener,
 	.listen = udp_bind_listener,
+	.enable = udp_enable_listener,
+	.disable = udp_disable_listener,
 	.rx_enable = sock_enable,
 	.rx_disable = sock_disable,
 	.rx_suspend = udp_suspend_receiver,
@@ -155,6 +161,24 @@
 	proto_udp6.nb_receivers++;
 }
 
+/* Enable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void udp_enable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_want_recv(l->rx.fd);
+}
+
+/* Disable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void udp_disable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_stop_recv(l->rx.fd);
+}
+
 /* Suspend a receiver. Returns < 0 in case of failure, 0 if the receiver
  * was totally stopped, or > 0 if correctly suspended.
  */
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 1febe3e..4ec672f 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -43,6 +43,8 @@
 static int uxst_bind_listener(struct listener *listener, char *errmsg, int errlen);
 static int uxst_connect_server(struct connection *conn, int flags);
 static void uxst_add_listener(struct listener *listener, int port);
+static void uxst_enable_listener(struct listener *listener);
+static void uxst_disable_listener(struct listener *listener);
 static int uxst_suspend_receiver(struct receiver *rx);
 
 /* Note: must not be declared <const> as its list will be overwritten */
@@ -55,6 +57,8 @@
 	.sock_prot = 0,
 	.add = uxst_add_listener,
 	.listen = uxst_bind_listener,
+	.enable = uxst_enable_listener,
+	.disable = uxst_disable_listener,
 	.rx_enable = sock_enable,
 	.rx_disable = sock_disable,
 	.rx_suspend = uxst_suspend_receiver,
@@ -148,6 +152,24 @@
 	proto_unix.nb_receivers++;
 }
 
+/* Enable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void uxst_enable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_want_recv(l->rx.fd);
+}
+
+/* Disable receipt of incoming connections for listener <l>. The receiver must
+ * still be valid. Does nothing in early boot (needs fd_updt).
+ */
+static void uxst_disable_listener(struct listener *l)
+{
+	if (fd_updt)
+		fd_stop_recv(l->rx.fd);
+}
+
 /* Suspend a receiver. Returns < 0 in case of failure, 0 if the receiver
  * was totally stopped, or > 0 if correctly suspended. Nothing is done for
  * plain unix sockets since currently it's the new process which handles