From 7a0da66e39fde8c06ab8af94a14113141076c969 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 23 Apr 2007 15:32:47 +0000 Subject: [PATCH] r22488: Hopefully fix ipv6. --- source/lib/socket/socket_ipv6.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source/lib/socket/socket_ipv6.c b/source/lib/socket/socket_ipv6.c index 06734a190c7..538420f5684 100644 --- a/source/lib/socket/socket_ipv6.c +++ b/source/lib/socket/socket_ipv6.c @@ -166,9 +166,11 @@ static NTSTATUS ipv6_tcp_listen(struct socket_context *sock, return map_nt_error_from_unix(errno); } - ret = listen(sock->fd, queue_size); - if (ret == -1) { - return map_nt_error_from_unix(errno); + if (sock->type == SOCKET_TYPE_STREAM) { + ret = listen(sock->fd, queue_size); + if (ret == -1) { + return map_nt_error_from_unix(errno); + } } if (!(flags & SOCKET_FLAG_BLOCK)) { @@ -390,6 +392,16 @@ static int ipv6_tcp_get_fd(struct socket_context *sock) return sock->fd; } +static NTSTATUS ipv6_pending(struct socket_context *sock, size_t *npending) +{ + int value = 0; + if (ioctl(sock->fd, FIONREAD, &value) == 0) { + *npending = value; + return NT_STATUS_OK; + } + return map_nt_error_from_unix(errno); +} + static const struct socket_ops ipv6_tcp_ops = { .name = "ipv6", .fn_init = ipv6_tcp_init, @@ -400,6 +412,7 @@ static const struct socket_ops ipv6_tcp_ops = { .fn_recv = ipv6_tcp_recv, .fn_send = ipv6_tcp_send, .fn_close = ipv6_tcp_close, + .fn_pending = ipv6_pending, .fn_set_option = ipv6_tcp_set_option, -- 2.11.4.GIT