MINOR: sock: Add protocol and socket types parameters to sock_create_server_socket()
This patch only adds <proto_type> new proto_type enum parameter and <sock_type> socket type parameter to sock_create_server_socket() and adapts its callers. This is to prepare the use of this function by QUIC servers/backends.
This commit is contained in:
parent
61454f5a52
commit
3ebda4e143
@ -28,9 +28,11 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/connection-t.h>
|
||||
#include <haproxy/listener-t.h>
|
||||
#include <haproxy/protocol-t.h>
|
||||
#include <haproxy/sock-t.h>
|
||||
|
||||
int sock_create_server_socket(struct connection *conn, struct proxy *be, int *stream_err);
|
||||
int sock_create_server_socket(struct connection *conn, struct proxy *be,
|
||||
enum proto_type proto_type, int sock_type, int *stream_err);
|
||||
void sock_enable(struct receiver *rx);
|
||||
void sock_disable(struct receiver *rx);
|
||||
void sock_unbind(struct receiver *rx);
|
||||
|
@ -306,7 +306,7 @@ int quic_connect_server(struct connection *conn, int flags)
|
||||
}
|
||||
|
||||
/* perform common checks on obtained socket FD, return appropriate Stream Error Flag in case of failure */
|
||||
fd = conn->handle.fd = sock_create_server_socket(conn, be, &stream_err);
|
||||
fd = conn->handle.fd = sock_create_server_socket(conn, be, PROTO_TYPE_DGRAM, SOCK_DGRAM, &stream_err);
|
||||
if (fd == -1)
|
||||
return stream_err;
|
||||
|
||||
|
@ -397,7 +397,7 @@ int tcp_connect_server(struct connection *conn, int flags)
|
||||
|
||||
|
||||
/* perform common checks on obtained socket FD, return appropriate Stream Error Flag in case of failure */
|
||||
fd = conn->handle.fd = sock_create_server_socket(conn, be, &stream_err);
|
||||
fd = conn->handle.fd = sock_create_server_socket(conn, be, PROTO_TYPE_STREAM, SOCK_STREAM, &stream_err);
|
||||
if (fd == -1)
|
||||
return stream_err;
|
||||
|
||||
|
@ -330,7 +330,7 @@ static int uxst_connect_server(struct connection *conn, int flags)
|
||||
}
|
||||
|
||||
/* perform common checks on obtained socket FD, return appropriate Stream Error Flag in case of failure */
|
||||
fd = conn->handle.fd = sock_create_server_socket(conn, be, &stream_err);
|
||||
fd = conn->handle.fd = sock_create_server_socket(conn, be, PROTO_TYPE_STREAM, SOCK_STREAM, &stream_err);
|
||||
if (fd == -1)
|
||||
return stream_err;
|
||||
|
||||
|
@ -265,7 +265,8 @@ static int sock_handle_system_err(struct connection *conn, struct proxy *be)
|
||||
* upper level is set as SF_ERR_NONE; -1 on failure, stream_err is set to
|
||||
* appropriate value.
|
||||
*/
|
||||
int sock_create_server_socket(struct connection *conn, struct proxy *be, int *stream_err)
|
||||
int sock_create_server_socket(struct connection *conn, struct proxy *be,
|
||||
enum proto_type proto_type, int sock_type, int *stream_err)
|
||||
{
|
||||
const struct netns_entry *ns = NULL;
|
||||
const struct protocol *proto;
|
||||
@ -279,9 +280,9 @@ int sock_create_server_socket(struct connection *conn, struct proxy *be, int *st
|
||||
ns = __objt_server(conn->target)->netns;
|
||||
}
|
||||
#endif
|
||||
proto = protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, conn->ctrl->sock_prot == IPPROTO_MPTCP);
|
||||
proto = protocol_lookup(conn->dst->ss_family, proto_type , conn->ctrl->sock_prot == IPPROTO_MPTCP);
|
||||
BUG_ON(!proto);
|
||||
sock_fd = my_socketat(ns, proto->fam->sock_domain, SOCK_STREAM, proto->sock_prot);
|
||||
sock_fd = my_socketat(ns, proto->fam->sock_domain, sock_type, proto->sock_prot);
|
||||
|
||||
/* at first, handle common to all proto families system limits and permission related errors */
|
||||
if (sock_fd == -1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user