/* Note: lib/util/ is currently GPL */
#include "lib/util/tevent_unix.h"
#include "lib/util/samba_util.h"
+#include "lib/util/debug.h"
+#include <linux/sockios.h>
+
+struct io_stats {
+ int fd;
+ size_t w;
+ size_t r;
+};
+
+static struct io_stats g;
+
+static void incr_write(int fd, size_t v)
+{
+ struct io_stats *s = &g;
+
+ s->w += v;
+}
+static void incr_read(int fd, size_t v)
+{
+ struct io_stats *s = &g;
+
+ s->r += v;
+}
+static void _debug_info(int fd, const char *location, const char *func)
+
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct io_stats *s = &g;
+ struct tcp_info info;
+ socklen_t ilen = sizeof(info);
+ int ret;
+ int val0;
+ int val1;
+ int val2;
+if (0) return;
+ ret = getsockopt(fd, IPPROTO_TCP,
+ TCP_INFO, (void *)&info, &ilen);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ ZERO_STRUCT(info);
+ }
+
+ ret = ioctl(fd, SIOCINQ, &val0);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ val0 = -1;
+ }
+ ret = ioctl(fd, SIOCOUTQ, &val1);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ val1 = -1;
+ }
+ ret = ioctl(fd, SIOCOUTQNSD, &val2);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ val1 = -1;
+ }
+ DEBUG(0,("%s:%s: %s: r[%u] w[%u] unacked[%u] sacked[%u] SIOCINQ[%u] SIOCOUTQ[%u] SIOCOUTQNSD[%u]\n",
+ location, func, current_timestring(talloc_tos(), true),
+ (unsigned)s->r, (unsigned)s->w,
+ (unsigned)info.tcpi_unacked,
+ (unsigned)info.tcpi_sacked,
+ (unsigned)val0,
+ (unsigned)val1,
+ (unsigned)val2));
+ TALLOC_FREE(frame);
+}
+
+#define debug_info(fd) _debug_info(fd, __location__, __func__)
struct async_connect_state {
int fd;
}
}
+ debug_info(state->fd);
+
written = writev(state->fd, state->iov, state->count);
if ((written == -1) && (errno == EINTR)) {
/* retry */
return;
}
+ incr_write(state->fd, written);
+ debug_info(state->fd);
+ DEBUG(0,("%s:%s: written[%u] total[%u]\n",
+ __location__, __func__,
+ (unsigned)written,
+ (unsigned)state->total_size));
if (state->count == 0) {
tevent_req_done(req);
return;
ssize_t nread, more;
uint8_t *tmp;
+ debug_info(state->fd);
nread = recv(state->fd, state->buf+state->nread, total-state->nread,
0);
if ((nread == -1) && (errno == ENOTSOCK)) {
return;
}
+ incr_read(state->fd, nread);
+ debug_info(state->fd);
+ DEBUG(0,("%s:%s: total[%u] nread[%u]\n",
+ __location__, __func__,
+ (unsigned)total,(unsigned)nread));
state->nread += nread;
if (state->nread < total) {
/* Come back later */
#include "auth.h"
#include "libcli/smb/smbXcli_base.h"
#include "lib/tevent_wait.h"
+<<<<<<< HEAD
#include <sys/ioctl.h>
+=======
+>>>>>>> 190d8dd... tcp ack... doesn't work for unix...
#include <linux/sockios.h>
#include "lib/crypto/gnutls_helpers.h"
return sys_errno;
}
+struct io_stats {
+ int fd;
+ size_t w;
+ size_t r;
+};
+
+static struct io_stats g;
+
+static void incr_write(int fd, size_t v)
+{
+ struct io_stats *s = &g;
+
+ s->w += v;
+}
+static void incr_read(int fd, size_t v)
+{
+ struct io_stats *s = &g;
+
+ s->r += v;
+}
+static void _debug_info(int fd, const char *location, const char *func)
+
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct io_stats *s = &g;
+ struct tcp_info info;
+ //socklen_t ilen = sizeof(info);
+ int ret;
+ int val0 = 0;
+ int val1 = 0;
+ int val2 = 0;
+
+ ZERO_STRUCT(info);
+ //ret = getsockopt(fd, IPPROTO_TCP,
+ // TCP_INFO, (void *)&info, &ilen);
+ //if (ret != 0) {
+ // DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ // location, func,
+ // errno, strerror(errno)));
+ // ZERO_STRUCT(info);
+ //}
+
+ ret = ioctl(fd, SIOCINQ, &val0);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ val0 = -1;
+ }
+ ret = ioctl(fd, SIOCOUTQ, &val1);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ val1 = -1;
+ }
+ //ret = ioctl(fd, SIOCOUTQNSD, &val2);
+ //if (ret != 0) {
+ // DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ // location, func,
+ // errno, strerror(errno)));
+ // val1 = -1;
+ //}
+ DEBUG(0,("%s:%s: %s: r[%u] w[%u] unacked[%u] sacked[%u] SIOCINQ[%u] SIOCOUTQ[%u] SIOCOUTQNSD[%u]\n",
+ location, func, current_timestring(talloc_tos(), true),
+ (unsigned)s->r, (unsigned)s->w,
+ (unsigned)info.tcpi_unacked,
+ (unsigned)info.tcpi_sacked,
+ (unsigned)val0,
+ (unsigned)val1,
+ (unsigned)val2));
+ TALLOC_FREE(frame);
+}
+
+#define debug_info(fd) _debug_info(fd, __location__, __func__)
static NTSTATUS smbd_smb2_check_ack_queue(struct smbXsrv_connection *xconn)
{
+<<<<<<< HEAD
struct smbd_smb2_send_queue *cur = NULL;
struct smbd_smb2_send_queue *next = NULL;
int value;
*/
break;
}
+=======
+ while (xconn->smb2.ack_queue != NULL) {
+ struct smbd_smb2_send_queue *e = xconn->smb2.ack_queue;
+
+ debug_info(xconn->transport.sock);
+>>>>>>> 190d8dd... tcp ack... doesn't work for unix...
DLIST_REMOVE(xconn->smb2.ack_queue, cur);
tevent_wait_done(cur->ack.req);
#if 0
if (e->ack.req != NULL && !e->ack.started) {
- struct tcp_info info;
- socklen_t ilen = sizeof(info);
-
- ret = getsockopt(xconn->transport.sock, IPPROTO_TCP,
- TCP_INFO, (void *)&info, &ilen);
- if (ret != 0) {
- DEBUG(0,("%s:%s: errno[%d/%s]\n",
- __location__, __func__,
- errno, strerror(errno)));
- ZERO_STRUCT(info);
- } else {
- DEBUG(0,("%s:%s: unacked[%u] sacked[%u]\n",
- __location__, __func__,
- (unsigned)info.tcpi_unacked,
- (unsigned)info.tcpi_sacked));
- }
+ //debug_info(xconn->transport.sock);
e->ack.started = true;
+<<<<<<< HEAD
e->ack.seqnum = info.tcpi_sacked + iov_buflen(e->vector, e->count);
ret = ioctl(xconn->transport.sock, SIOCOUTQ, &value1);
__location__, __func__,
value1));
}
+=======
+ e->ack.seqnum = 0;//info.tcpi_sacked + iov_buflen(e->vector, e->count);
+>>>>>>> 190d8dd... tcp ack... doesn't work for unix...
}
#endif
+<<<<<<< HEAD
msg = (struct msghdr) {
.msg_iov = e->vector,
.msg_iovlen = e->count,
};
ret = sendmsg(xconn->transport.sock, &msg, 0);
+=======
+ debug_info(xconn->transport.sock);
+ ret = writev(xconn->transport.sock, e->vector, e->count);
+>>>>>>> 08445023786d... BROKEN; was commit 190d8dd34c20cfc89ce8d3e2eb356ef761cac6e6 tcp ack... doesn't work for unix...
if (ret == 0) {
/* propagate end of file */
return NT_STATUS_INTERNAL_ERROR;
return map_nt_error_from_unix_common(err);
}
+<<<<<<< HEAD
xconn->smb2.sent_bytes += ret;
+=======
+ incr_write(xconn->transport.sock, ret);
+>>>>>>> 190d8dd... tcp ack... doesn't work for unix...
ok = iov_advance(&e->vector, &e->count, ret);
if (!ok) {
}
if (e->ack.req != NULL && e->ack.started) {
- tevent_wait_done(e->ack.req);
+ //tevent_wait_done(e->ack.req);
}
+ debug_info(xconn->transport.sock);
xconn->smb2.send_queue_len--;
DLIST_REMOVE(xconn->smb2.send_queue, e);
state->vector.iov_len = NBT_HDR_SIZE;
}
+<<<<<<< HEAD
msg = (struct msghdr) {
.msg_iov = &state->vector,
.msg_iovlen = 1,
};
ret = recvmsg(xconn->transport.sock, &msg, 0);
+=======
+ debug_info(xconn->transport.sock);
+ ret = readv(xconn->transport.sock, &state->vector, 1);
+>>>>>>> 08445023786d... BROKEN; was commit 190d8dd34c20cfc89ce8d3e2eb356ef761cac6e6 tcp ack... doesn't work for unix...
if (ret == 0) {
/* propagate end of file */
return NT_STATUS_END_OF_FILE;
return map_nt_error_from_unix_common(err);
}
+<<<<<<< HEAD
status = smbd_smb2_check_ack_queue(xconn);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
+=======
+ incr_read(xconn->transport.sock, ret);
+ debug_info(xconn->transport.sock);
+>>>>>>> 190d8dd... tcp ack... doesn't work for unix...
if (ret < state->vector.iov_len) {
uint8_t *base;
base = (uint8_t *)state->vector.iov_base;