]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:lib: split out open_socket_in_protocol()
authorStefan Metzmacher <metze@samba.org>
Thu, 3 Apr 2025 15:14:32 +0000 (17:14 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 18 Apr 2025 10:17:29 +0000 (10:17 +0000)
This will be useful if we want to listen on IPPROTO_QUIC
sockets.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/include/proto.h
source3/lib/util_sock.c

index 75270c1a0255bbaa8b70ffc3b7da02b920e999c7..ba1238ea27b7c360b7c315ed2cfa75b66e273e72 100644 (file)
@@ -483,6 +483,12 @@ NTSTATUS receive_smb_raw(int fd,
                        unsigned int timeout,
                        size_t maxlen,
                        size_t *p_len);
+int open_socket_in_protocol(
+       int type,
+       int protocol,
+       const struct sockaddr_storage *paddr,
+       uint16_t port,
+       bool rebind);
 int open_socket_in(
        int type,
        const struct sockaddr_storage *paddr,
index 5b4d7f12cef1b8c23c4667a6bd9baab877b06020..910e7fd75e1d8525190626347d28ceda5ecc0f5b 100644 (file)
@@ -241,8 +241,9 @@ NTSTATUS receive_smb_raw(int fd, char *buffer, size_t buflen, unsigned int timeo
  * Return sock or -errno
  */
 
-int open_socket_in(
+int open_socket_in_protocol(
        int type,
+       int protocol,
        const struct sockaddr_storage *paddr,
        uint16_t port,
        bool rebind)
@@ -271,7 +272,7 @@ int open_socket_in(
                goto fail;
        }
 
-       sock = socket(addr.u.ss.ss_family, type, );
+       sock = socket(addr.u.ss.ss_family, type, protocol);
        if (sock == -1) {
                ret = -errno;
                DBG_DEBUG("socket() failed: %s\n", strerror(errno));
@@ -353,6 +354,15 @@ fail:
        return ret;
  }
 
+int open_socket_in(
+       int type,
+       const struct sockaddr_storage *paddr,
+       uint16_t port,
+       bool rebind)
+{
+       return open_socket_in_protocol(type, 0, paddr, port, rebind);
+}
+
 struct open_socket_out_state {
        int fd;
        struct tevent_context *ev;