The branch, master has been updated
       via  19723ed0fcdf267ece3dbcde503f86093aceb39b (commit)
      from  5c19c60c5741196fc0a2b8db901e1be02139ae4e (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 19723ed0fcdf267ece3dbcde503f86093aceb39b
Author: Andrew Bartlett <abart...@samba.org>
Date:   Fri Jun 19 13:25:28 2009 +1000

    Partially revert restriction of socket_wrapper to 1500 byte writes
    
    This keeps the restriction for stream sockets (where the caller will
    retry), without creating problems on datagram sockets (CLDAP is not
    defined, as far as I know, across multiple UDP packets).
    
    The commit adding this restriction was
    47b106c0ae8b91c9cccfc21bf8e4e416b1abfd5d
    
    Andrew Bartlett

-----------------------------------------------------------------------

Summary of changes:
 lib/socket_wrapper/socket_wrapper.c |   42 ++++++++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/socket_wrapper/socket_wrapper.c 
b/lib/socket_wrapper/socket_wrapper.c
index 8563400..933b126 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -1862,7 +1862,12 @@ _PUBLIC_ ssize_t swrap_recvfrom(int s, void *buf, size_t 
len, int flags, struct
                fromlen = &ss_len;
        }
 
-       len = MIN(len, 1500);
+       if (si->type == SOCK_STREAM) {
+               /* cut down to 1500 byte packets for stream sockets,
+                * which makes it easier to format PCAP capture files
+                * (as the caller will simply continue from here) */
+               len = MIN(len, 1500);
+       }
 
        /* irix 6.4 forgets to null terminate the sun_path string :-( */
        memset(&un_addr, 0, sizeof(un_addr));
@@ -1902,10 +1907,13 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, 
size_t len, int flags, con
                tolen = si->peername_len;
        }
 
-       len = MIN(len, 1500);
-
        switch (si->type) {
        case SOCK_STREAM:
+               /* cut down to 1500 byte packets for stream sockets,
+                * which makes it easier to format PCAP capture files
+                * (as the caller will simply continue from here) */
+               len = MIN(len, 1500);
+       
                ret = real_send(s, buf, len, flags);
                break;
        case SOCK_DGRAM:
@@ -2012,7 +2020,12 @@ _PUBLIC_ ssize_t swrap_recv(int s, void *buf, size_t 
len, int flags)
                return real_recv(s, buf, len, flags);
        }
 
-       len = MIN(len, 1500);
+       if (si->type == SOCK_STREAM) {
+               /* cut down to 1500 byte packets for stream sockets,
+                * which makes it easier to format PCAP capture files
+                * (as the caller will simply continue from here) */
+               len = MIN(len, 1500);
+       }
 
        ret = real_recv(s, buf, len, flags);
        if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
@@ -2036,7 +2049,12 @@ _PUBLIC_ ssize_t swrap_send(int s, const void *buf, 
size_t len, int flags)
                return real_send(s, buf, len, flags);
        }
 
-       len = MIN(len, 1500);
+       if (si->type == SOCK_STREAM) {
+               /* cut down to 1500 byte packets for stream sockets,
+                * which makes it easier to format PCAP capture files
+                * (as the caller will simply continue from here) */
+               len = MIN(len, 1500);
+       }
 
        if (si->defer_connect) {
                struct sockaddr_un un_addr;
@@ -2157,10 +2175,12 @@ int swrap_readv(int s, const struct iovec *vector, 
size_t count)
                return real_readv(s, vector, count);
        }
 
-       /* we read 1500 bytes as maximum */
-       if (count > 0) {
+       if (si->type == SOCK_STREAM && count > 0) {
+               /* cut down to 1500 byte packets for stream sockets,
+                * which makes it easier to format PCAP capture files
+                * (as the caller will simply continue from here) */
                size_t i, len = 0;
-
+               
                for (i=0; i < count; i++) {
                        size_t nlen;
                        nlen = len + vector[i].iov_len;
@@ -2222,8 +2242,10 @@ int swrap_writev(int s, const struct iovec *vector, 
size_t count)
                return real_writev(s, vector, count);
        }
 
-       /* we write 1500 bytes as maximum */
-       if (count > 0) {
+       if (si->type == SOCK_STREAM && count > 0) {
+               /* cut down to 1500 byte packets for stream sockets,
+                * which makes it easier to format PCAP capture files
+                * (as the caller will simply continue from here) */
                size_t i, len = 0;
 
                for (i=0; i < count; i++) {


-- 
Samba Shared Repository

Reply via email to