The Samba-Bugzilla – Attachment 8606 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]
pathes for master to address metze's concerns and apply to tsocket_bsd
EMSGSIZE-master.patch (text/plain), 2.80 KB, created by
Andrew Bartlett
on 2013-03-04 05:27:25 UTC
(
hide
)
Description:
pathes for master to address metze's concerns and apply to tsocket_bsd
Filename:
MIME Type:
Creator:
Andrew Bartlett
Created:
2013-03-04 05:27:25 UTC
Size:
2.80 KB
patch
obsolete
>From 20dd3b9ca5004b740784917103a407d2bef80570 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Mon, 4 Mar 2013 14:07:38 +1100 >Subject: [PATCH 1/2] s4-lib/socket: Return the original EMSGSIZE when > sendto() and setsockopt() both fail > >This ensures that should we be unable to increase the socket size, we return an >error that the application layer above might expect and be able to make >as reasonable response to (such as switching to a stream-based transport). > >This fixes up c692bb02b039ae8fef6ba968fd13b36ad7d62a72. > >As suggested by metze in https://bugzilla.samba.org/show_bug.cgi?id=9697#c4 > >Andrew Bartlett >--- > source4/lib/socket/socket_unix.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c >index 049e570..0774b12 100644 >--- a/source4/lib/socket/socket_unix.c >+++ b/source4/lib/socket/socket_unix.c >@@ -295,7 +295,7 @@ static NTSTATUS unixdom_sendto(struct socket_context *sock, > if (setsockopt(sock->fd, SOL_SOCKET, SO_SNDBUF, &bufsize, > sizeof(bufsize)) == -1) > { >- return map_nt_error_from_unix_common(errno); >+ return map_nt_error_from_unix_common(EMSGSIZE); > } > len = sendto(sock->fd, blob->data, blob->length, 0, sa, sa_len); > } >-- >1.7.11.7 > > >From d27c67b3e2807019a6b5bde1361ea847f37faa89 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Mon, 4 Mar 2013 14:06:14 +1100 >Subject: [PATCH 2/2] tsocket_bsd: Attempt to increase the SO_SNDBUF if we get > EMSGSIZE in sendto() > >This matches what was done for lib/socket/socket_unix.c in >c692bb02b039ae8fef6ba968fd13b36ad7d62a72. > >(and is based on that patch by Landon Fuller <landonf@bikemonkey.org>) > >Andrew Bartlett >--- > lib/tsocket/tsocket_bsd.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > >diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c >index 56dff68..d38d569 100644 >--- a/lib/tsocket/tsocket_bsd.c >+++ b/lib/tsocket/tsocket_bsd.c >@@ -1102,6 +1102,32 @@ static void tdgram_bsd_sendto_handler(void *private_data) > /* retry later */ > return; > } >+ >+ if (err == EMSGSIZE) { >+ /* round up in 1K increments */ >+ int bufsize = ((state->len + 1023) & (~1023)); >+ if (setsockopt(bsds->fd, SOL_SOCKET, SO_SNDBUF, &bufsize, >+ sizeof(bufsize)) == 0) >+ { >+ /* >+ * We do the rety here, rather then via the >+ * handler, as we only want to retry once for >+ * this condition, so if there is a mismatch >+ * between what setsockopt() accepts and what can >+ * actually be sent, we do not end up in a >+ * loop. >+ */ >+ >+ ret = sendto(bsds->fd, state->buf, state->len, >+ 0, sa, sa_socklen); err = >+ tsocket_bsd_error_from_errno(ret, errno, >+ &retry); if (retry) { /* retry later */ >+ return; >+ } >+ } >+ >+ } >+ > if (tevent_req_error(req, err)) { > return; > } >-- >1.7.11.7 >
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