The Samba-Bugzilla – Attachment 8603 Details for
Bug 9697
DsReplicaGetInfo fails due to sendto() EMSGSIZE error on UNIX domain socket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git format-patch
0001-Handle-EMSGSIZE-on-UNIX-domain-sockets.patch (text/plain), 2.60 KB, created by
Landon Fuller
on 2013-03-02 19:20:04 UTC
(
hide
)
Description:
git format-patch
Filename:
MIME Type:
Creator:
Landon Fuller
Created:
2013-03-02 19:20:04 UTC
Size:
2.60 KB
patch
obsolete
>From 21bf19d84eab528f67d322058c009155df17ef7f Mon Sep 17 00:00:00 2001 >From: Landon Fuller <landonf@bikemonkey.org> >Date: Sat, 2 Mar 2013 14:08:47 -0500 >Subject: [PATCH] Handle EMSGSIZE on UNIX domain sockets. > >On some systems (eg, FreeBSD) the default SO_SNDBUF for UNIX >domain sockets is to small, and EMSGSIZE is returned. Other >systems provide a larger default send buffer, but there is >still no guarantee that the buffer will be sized appropriately. > >This patch modifies the sendto() path to attempt to resize >the SO_SNDBUF dynamically upon an EMSGSIZE failure, and then >retry the send. > >This fixes local DCE/RPC errors on FreeBSD, eg: > >https://lists.samba.org/archive/samba-technical/2013-January/089881.html > >Signed-Off-By: Landon Fuller <landonf@bikemonkey.org> >--- > source4/lib/socket/socket_unix.c | 35 ++++++++++++++++++++++++++--------- > 1 file changed, 26 insertions(+), 9 deletions(-) > >diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c >index 4755e79..049e570 100644 >--- a/source4/lib/socket/socket_unix.c >+++ b/source4/lib/socket/socket_unix.c >@@ -263,26 +263,43 @@ static NTSTATUS unixdom_sendto(struct socket_context *sock, > const DATA_BLOB *blob, size_t *sendlen, > const struct socket_address *dest) > { >+ struct sockaddr_un srv_addr; >+ const struct sockaddr *sa; >+ socklen_t sa_len; > ssize_t len; >+ > *sendlen = 0; >- >+ > if (dest->sockaddr) { >- len = sendto(sock->fd, blob->data, blob->length, 0, >- dest->sockaddr, dest->sockaddrlen); >+ sa = dest->sockaddr; >+ sa_len = dest->sockaddrlen; > } else { >- struct sockaddr_un srv_addr; >- > if (strlen(dest->addr)+1 > sizeof(srv_addr.sun_path)) { > return NT_STATUS_OBJECT_PATH_INVALID; > } >- >+ > ZERO_STRUCT(srv_addr); > srv_addr.sun_family = AF_UNIX; >- snprintf(srv_addr.sun_path, sizeof(srv_addr.sun_path), "%s", dest->addr); >+ snprintf(srv_addr.sun_path, sizeof(srv_addr.sun_path), "%s", >+ dest->addr); >+ sa = (struct sockaddr *) &srv_addr; >+ sa_len = sizeof(srv_addr); >+ } >+ >+ len = sendto(sock->fd, blob->data, blob->length, 0, sa, sa_len); > >- len = sendto(sock->fd, blob->data, blob->length, 0, >- (struct sockaddr *)&srv_addr, sizeof(srv_addr)); >+ /* retry once */ >+ if (len == -1 && errno == EMSGSIZE) { >+ /* round up in 1K increments */ >+ int bufsize = ((blob->length + 1023) & (~1023)); >+ if (setsockopt(sock->fd, SOL_SOCKET, SO_SNDBUF, &bufsize, >+ sizeof(bufsize)) == -1) >+ { >+ return map_nt_error_from_unix_common(errno); >+ } >+ len = sendto(sock->fd, blob->data, blob->length, 0, sa, sa_len); > } >+ > if (len == -1) { > return map_nt_error_from_unix_common(errno); > } >-- >1.8.1.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 9697
:
8603
|
8604
|
8605
|
8606
|
8607