From 6bbcf1114c1b0382f167cc9baf25900809bf60c5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Apr 2025 11:16:10 +0200 Subject: [PATCH] s3:smbd: use open_socket_in_protocol() in smbd_open_one_socket() For now this is always explicitly IPPROTO_TCP, but that will change when we add support for IPPROTO_QUIC. Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- source3/smbd/server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index d4627a21be2..3c5907d5aa5 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1090,11 +1090,15 @@ static bool smbd_open_one_socket(struct smbd_parent_context *parent, { struct smbd_open_socket *s; uint16_t port = 0; + int protocol = 0; + bool rebind = false; switch (transport->type) { case SMB_TRANSPORT_TYPE_TCP: case SMB_TRANSPORT_TYPE_NBT: port = transport->port; + protocol = IPPROTO_TCP; + rebind = true; break; case SMB_TRANSPORT_TYPE_UNKNOWN: /* @@ -1119,7 +1123,7 @@ static bool smbd_open_one_socket(struct smbd_parent_context *parent, s->parent = parent; s->transport = *transport; - s->fd = open_socket_in(SOCK_STREAM, ifss, port, true); + s->fd = open_socket_in_protocol(SOCK_STREAM, protocol, ifss, port, rebind); if (s->fd < 0) { int err = -(s->fd); DBG_ERR("open_socket_in failed: %s\n", strerror(err)); -- 2.47.3