summaryrefslogtreecommitdiff
path: root/netcon
diff options
context:
space:
mode:
authorJoseph Henry <joseph.henry@zerotier.com>2015-10-16 18:02:07 -0400
committerJoseph Henry <joseph.henry@zerotier.com>2015-10-16 18:02:07 -0400
commit0405ba1ccfa5630ce16802e2d74bc799972fb613 (patch)
tree8f46cc1abf298093aef8c644b1673523d3a08873 /netcon
parentb96c08f35c2afd07daf261451daad7004c73f42d (diff)
downloadinfinitytier-0405ba1ccfa5630ce16802e2d74bc799972fb613.tar.gz
infinitytier-0405ba1ccfa5630ce16802e2d74bc799972fb613.zip
Misc changes
Diffstat (limited to 'netcon')
-rwxr-xr-xnetcon/Intercept.c11
-rw-r--r--netcon/NetconEthernetTap.cpp13
-rwxr-xr-xnetcon/libintercept.so.1.0bin45880 -> 45992 bytes
-rwxr-xr-xnetcon/liblwip.sobin0 -> 342016 bytes
4 files changed, 21 insertions, 3 deletions
diff --git a/netcon/Intercept.c b/netcon/Intercept.c
index aed7d185..c53c1015 100755
--- a/netcon/Intercept.c
+++ b/netcon/Intercept.c
@@ -494,6 +494,13 @@ int connect(CONNECT_SIG)
return err;
}
+ //int flags = fcntl(__fd, F_GETFD);
+ //dwr("connect(): socket flags = %d\n", flags);
+
+ if(sock_type && O_NONBLOCK) {
+ dwr("connect(): O_NONBLOCK\n");
+ }
+
/* assemble and route command */
int err;
char cmd[BUF_SZ];
@@ -507,6 +514,10 @@ int connect(CONNECT_SIG)
memcpy(&cmd[1], &rpc_st, sizeof(struct connect_st));
pthread_mutex_lock(&lock);
send_command(fdret_sock, cmd);
+ if(sock_type && O_NONBLOCK) {
+ //pthread_mutex_unlock(&lock);
+ //return EINPROGRESS;
+ }
err = get_retval();
pthread_mutex_unlock(&lock);
return err;
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp
index 462e366d..003e0b66 100644
--- a/netcon/NetconEthernetTap.cpp
+++ b/netcon/NetconEthernetTap.cpp
@@ -318,6 +318,8 @@ void NetconEthernetTap::threadMain()
fprintf(stderr, "_threadMain()\n");
uint64_t prev_tcp_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));
@@ -327,7 +329,7 @@ void NetconEthernetTap::threadMain()
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, "- IP_REASSEMBLY = %d\n", IP_REASSEMBLY);
fprintf(stderr, "- TCP_WND = %d\n", TCP_WND);
fprintf(stderr, "- TCP_MSS = %d\n", TCP_MSS);
@@ -376,9 +378,13 @@ void NetconEthernetTap::phyOnFileDescriptorActivity(PhySocket *sock,void **uptr,
{
if(readable) {
TcpConnection *conn = (TcpConnection*)*uptr;
- Mutex::Lock _l(lwipstack->_lock);
if(conn->dataSock) // Sometimes a connection may be closed via nc_recved, check first
+ {
+ //Mutex::Lock _l(lwipstack->_lock);
+ //lwipstack->_lock.lock();
handle_write(conn);
+ //lwipstack->_lock.unlock();
+ }
}
else {
fprintf(stderr, "phyOnFileDescriptorActivity(): PhySocket not readable\n");
@@ -1144,8 +1150,9 @@ 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);
if(err != ERR_OK) {
- fprintf(stderr, "handle_write(): error while writing to PCB\n");
+ fprintf(stderr, "handle_write(): error while writing to PCB, (err = %d)\n", err);
return;
}
else {
diff --git a/netcon/libintercept.so.1.0 b/netcon/libintercept.so.1.0
index bb203d64..fa9cdf28 100755
--- a/netcon/libintercept.so.1.0
+++ b/netcon/libintercept.so.1.0
Binary files differ
diff --git a/netcon/liblwip.so b/netcon/liblwip.so
new file mode 100755
index 00000000..aba90d8e
--- /dev/null
+++ b/netcon/liblwip.so
Binary files differ