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
+ 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));
/* irix 6.4 forgets to null terminate the sun_path string :-( */
memset(&un_addr, 0, sizeof(un_addr));
tolen = si->peername_len;
}
tolen = si->peername_len;
}
- len = MIN(len, 1500);
-
switch (si->type) {
case SOCK_STREAM:
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:
ret = real_send(s, buf, len, flags);
break;
case SOCK_DGRAM:
return real_recv(s, buf, len, flags);
}
return real_recv(s, buf, len, flags);
}
+ 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) {
ret = real_recv(s, buf, len, flags);
if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
return real_send(s, buf, len, flags);
}
return real_send(s, buf, len, flags);
}
+ 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;
if (si->defer_connect) {
struct sockaddr_un un_addr;
return real_readv(s, vector, 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) */
for (i=0; i < count; i++) {
size_t nlen;
nlen = len + vector[i].iov_len;
for (i=0; i < count; i++) {
size_t nlen;
nlen = len + vector[i].iov_len;
return real_writev(s, vector, 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++) {
size_t i, len = 0;
for (i=0; i < count; i++) {