]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: use open_socket_in_protocol() in smbd_open_one_socket()
authorStefan Metzmacher <metze@samba.org>
Tue, 8 Apr 2025 09:16:10 +0000 (11:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 18 Apr 2025 10:17:29 +0000 (10:17 +0000)
For now this is always explicitly IPPROTO_TCP,
but that will change when we add support for IPPROTO_QUIC.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/server.c

index d4627a21be254629922200c862e9cf564feaf6f0..3c5907d5aa562f2d55a1348d7f9fa371c7940d6d 100644 (file)
@@ -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));