diff options
author | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-16 19:30:01 -0400 |
---|---|---|
committer | Joseph Henry <joseph.henry@zerotier.com> | 2015-10-16 19:30:01 -0400 |
commit | 8b03965912d3a3070c4e447c65b70a7c16067ee2 (patch) | |
tree | fa32c0023b0532024e2d1cb438aa2f90b0e30fbb | |
parent | 0405ba1ccfa5630ce16802e2d74bc799972fb613 (diff) | |
download | infinitytier-8b03965912d3a3070c4e447c65b70a7c16067ee2.tar.gz infinitytier-8b03965912d3a3070c4e447c65b70a7c16067ee2.zip |
Added status debugs
-rwxr-xr-x | netcon/Intercept.c | 12 | ||||
-rw-r--r-- | netcon/NetconEthernetTap.cpp | 26 | ||||
-rwxr-xr-x | netcon/libintercept.so.1.0 | bin | 45992 -> 45888 bytes |
3 files changed, 25 insertions, 13 deletions
diff --git a/netcon/Intercept.c b/netcon/Intercept.c index c53c1015..d431f825 100755 --- a/netcon/Intercept.c +++ b/netcon/Intercept.c @@ -496,10 +496,9 @@ int connect(CONNECT_SIG) //int flags = fcntl(__fd, F_GETFD); //dwr("connect(): socket flags = %d\n", flags); - - if(sock_type && O_NONBLOCK) { - dwr("connect(): O_NONBLOCK\n"); - } + //if(sock_type && O_NONBLOCK) { + // dwr("connect(): O_NONBLOCK\n"); + //} /* assemble and route command */ int err; @@ -656,6 +655,11 @@ int accept(ACCEPT_SIG) errno = EMFILE; return -1; } + /* Check address length */ + if(addrlen < 0) { + errno = EINVAL; + return -1; + } #endif /* make sure we don't touch any standard outputs */ diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp index 003e0b66..a5ce6f80 100644 --- a/netcon/NetconEthernetTap.cpp +++ b/netcon/NetconEthernetTap.cpp @@ -51,6 +51,7 @@ #define APPLICATION_POLL_FREQ 1 #define ZT_LWIP_TCP_TIMER_INTERVAL 10 +#define STATUS_TMR_INTERVAL 1000 namespace ZeroTier { @@ -317,9 +318,8 @@ void NetconEthernetTap::threadMain() { fprintf(stderr, "_threadMain()\n"); uint64_t prev_tcp_time = 0; + uint64_t prev_status_time = 0; uint64_t prev_etharp_time = 0; -fprintf(stderr, "- TCP_SND_QUEUELEN = %d\n", TCP_SND_QUEUELEN); -fprintf(stderr, "- TCP_MAXRTX = %d\n", TCP_MAXRTX); /* fprintf(stderr, "- MEM_SIZE = %dM\n", MEM_SIZE / (1024*1024)); @@ -329,7 +329,8 @@ fprintf(stderr, "- TCP_MAXRTX = %d\n", TCP_MAXRTX); fprintf(stderr, "- MEMP_NUM_TCP_PCB_LISTEN = %d\n", MEMP_NUM_TCP_PCB_LISTEN); fprintf(stderr, "- MEMP_NUM_TCP_SEG = %d\n", MEMP_NUM_TCP_SEG); fprintf(stderr, "- PBUF_POOL_SIZE = %d\n", PBUF_POOL_SIZE); - + fprintf(stderr, "- TCP_SND_QUEUELEN = %d\n", TCP_SND_QUEUELEN); + fprintf(stderr, "- TCP_MAXRTX = %d\n", TCP_MAXRTX); fprintf(stderr, "- IP_REASSEMBLY = %d\n", IP_REASSEMBLY); fprintf(stderr, "- TCP_WND = %d\n", TCP_WND); fprintf(stderr, "- TCP_MSS = %d\n", TCP_MSS); @@ -340,14 +341,20 @@ fprintf(stderr, "- TCP_MAXRTX = %d\n", TCP_MAXRTX); // Main timer loop while (_run) { + uint64_t now = OSUtils::now(); uint64_t since_tcp = now - prev_tcp_time; uint64_t since_etharp = now - prev_etharp_time; - + uint64_t since_status = now - prev_status_time; uint64_t tcp_remaining = ZT_LWIP_TCP_TIMER_INTERVAL; uint64_t etharp_remaining = ARP_TMR_INTERVAL; + uint64_t status_remaining = STATUS_TMR_INTERVAL; + if (since_status >= STATUS_TMR_INTERVAL) { + prev_status_time = now; + fprintf(stderr, "tcp_conns = %d, rpc_socks = %d\n", tcp_connections.size(), rpc_sockets.size()); + } if (since_tcp >= ZT_LWIP_TCP_TIMER_INTERVAL) { prev_tcp_time = now; lwipstack->tcp_tmr(); @@ -381,9 +388,9 @@ void NetconEthernetTap::phyOnFileDescriptorActivity(PhySocket *sock,void **uptr, if(conn->dataSock) // Sometimes a connection may be closed via nc_recved, check first { //Mutex::Lock _l(lwipstack->_lock); - //lwipstack->_lock.lock(); + lwipstack->_lock.lock(); handle_write(conn); - //lwipstack->_lock.unlock(); + lwipstack->_lock.unlock(); } } else { @@ -515,7 +522,7 @@ int NetconEthernetTap::send_return_value(int fd, int retval, int _errno = 0) [I] ECONNABORTED - A connection has been aborted. [i] EFAULT - The addr argument is not in a writable part of the user address space. [-] EINTR - The system call was interrupted by a signal that was caught before a valid connection arrived; see signal(7). - [?] EINVAL - Socket is not listening for connections, or addrlen is invalid (e.g., is negative). + [I] EINVAL - Socket is not listening for connections, or addrlen is invalid (e.g., is negative). [I] EINVAL - (accept4()) invalid value in flags. [I] EMFILE - The per-process limit of open file descriptors has been reached. [ ] ENFILE - The system limit on the total number of open files has been reached. @@ -755,7 +762,8 @@ err_t NetconEthernetTap::nc_poll(void* arg, struct tcp_pcb *tpcb) * */ err_t NetconEthernetTap::nc_sent(void* arg, struct tcp_pcb *tpcb, u16_t len) -{fprintf(stderr, "nc_sent()\n"); +{ + //fprintf(stderr, "nc_sent()\n"); Larg *l = (Larg*)arg; if(len) { //fprintf(stderr, "ACKING len = %d, setting read-notify = true, (sndbuf = %d)\n", len, l->conn->pcb->snd_buf); @@ -1150,7 +1158,7 @@ void NetconEthernetTap::handle_write(TcpConnection *conn) // NOTE: this assumes that lwipstack->_lock is locked, either // because we are in a callback or have locked it manually. int err = lwipstack->_tcp_write(conn->pcb, &conn->buf, r, TCP_WRITE_FLAG_COPY); - lwipstack->_tcp_output(conn->pcb); + //lwipstack->_tcp_output(conn->pcb); if(err != ERR_OK) { fprintf(stderr, "handle_write(): error while writing to PCB, (err = %d)\n", err); return; diff --git a/netcon/libintercept.so.1.0 b/netcon/libintercept.so.1.0 Binary files differindex fa9cdf28..de9dff34 100755 --- a/netcon/libintercept.so.1.0 +++ b/netcon/libintercept.so.1.0 |