diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-04-23 15:32:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:51:33 -0500 |
commit | c58042c90e31fa77b91bd065f3b8e5db6307ed51 (patch) | |
tree | abf3182249051b8270135b0e1c22154974e41455 /source4/lib | |
parent | 9e752901b229149fc08937df4d897340611c671a (diff) | |
download | samba-c58042c90e31fa77b91bd065f3b8e5db6307ed51.tar.gz samba-c58042c90e31fa77b91bd065f3b8e5db6307ed51.tar.bz2 samba-c58042c90e31fa77b91bd065f3b8e5db6307ed51.zip |
r22488: Hopefully fix ipv6.
(This used to be commit 7a0da66e39fde8c06ab8af94a14113141076c969)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/socket/socket_ipv6.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c index 06734a190c..538420f568 100644 --- a/source4/lib/socket/socket_ipv6.c +++ b/source4/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, |