summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Henry <joseph.henry@gmail.com>2015-10-23 14:23:04 -0700
committerJoseph Henry <joseph.henry@gmail.com>2015-10-23 14:23:04 -0700
commit80a73cb14b1e6b02f8789f11506933592e554bb2 (patch)
tree9d70aadad916f3aa4867d6b364450b9804fbce2c
parentb48ed824e60babf4b142fe6b874d53ca382bb2db (diff)
downloadinfinitytier-80a73cb14b1e6b02f8789f11506933592e554bb2.tar.gz
infinitytier-80a73cb14b1e6b02f8789f11506933592e554bb2.zip
Minor cleanup
-rwxr-xr-xnetcon/Intercept.c2
-rwxr-xr-xnetcon/Intercept.h2
-rw-r--r--netcon/NetconEthernetTap.cpp29
-rwxr-xr-xnetcon/libintercept.so.1.0bin47448 -> 47448 bytes
4 files changed, 17 insertions, 16 deletions
diff --git a/netcon/Intercept.c b/netcon/Intercept.c
index 3a44419a..2a32be17 100755
--- a/netcon/Intercept.c
+++ b/netcon/Intercept.c
@@ -103,9 +103,7 @@ void load_symbols(void);
void set_up_intercept();
int checkpid();
-#define BUF_SZ 32
#define SERVICE_CONNECT_ATTEMPTS 30
-#define ERR_OK 0
ssize_t sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd);
diff --git a/netcon/Intercept.h b/netcon/Intercept.h
index 1a36cf76..9b9d5a97 100755
--- a/netcon/Intercept.h
+++ b/netcon/Intercept.h
@@ -31,6 +31,8 @@
#include <sys/socket.h>
+#define BUF_SZ 32
+#define ERR_OK 0
/* Userland RPC codes */
#define RPC_UNDEFINED 0
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp
index ec3a9994..ad573fed 100644
--- a/netcon/NetconEthernetTap.cpp
+++ b/netcon/NetconEthernetTap.cpp
@@ -53,7 +53,6 @@
#define ZT_LWIP_TCP_TIMER_INTERVAL 10
#define STATUS_TMR_INTERVAL 500 // How often we check connection statuses
-
namespace ZeroTier {
NetconEthernetTap::NetconEthernetTap(
@@ -361,16 +360,16 @@ void NetconEthernetTap::threadMain()
that the client has closed their end and we can close ours */
for(size_t i = 0; i<tcp_connections.size(); i++) {
if(tcp_connections[i]->listening) {
- char c;
- if (read(_phy.getDescriptor(tcp_connections[i]->dataSock), &c, 1) < 0) {
- // Still in listening state
- }
- else {
- // Here we should handle the case there there is incoming data (?)
- fprintf(stderr, "Listening socketpair closed. Removing RPC connection (%d)\n",
- _phy.getDescriptor(tcp_connections[i]->dataSock));
- closeConnection(tcp_connections[i]);
- }
+ char c;
+ if (read(_phy.getDescriptor(tcp_connections[i]->dataSock), &c, 1) < 0) {
+ // Still in listening state
+ }
+ else {
+ // Here we should handle the case there there is incoming data (?)
+ fprintf(stderr, "Listening socketpair closed. Removing RPC connection (%d)\n",
+ _phy.getDescriptor(tcp_connections[i]->dataSock));
+ closeConnection(tcp_connections[i]);
+ }
}
}
}
@@ -382,13 +381,15 @@ void NetconEthernetTap::threadMain()
}
if(!associated){
// No TCP connections are associated, this is a candidate for removal
- char c;
- if(read(_phy.getDescriptor(rpc_sockets[i]),&c,1) < 0) {
+ unsigned char tmpbuf[BUF_SZ];
+ if(read(_phy.getDescriptor(rpc_sockets[i]),&tmpbuf,BUF_SZ) < 0) {
closeClient(rpc_sockets[i]);
}
else {
// Handle RPC call, this is rare
- // phyOnUnixData(PhySocket *sock,void **uptr,void *data,unsigned long len)
+ fprintf(stderr, "run(): RPC read during connection check\n");
+ exit(0);
+ phyOnUnixData(rpc_sockets[i],NULL,&tmpbuf,BUF_SZ);
}
}
}
diff --git a/netcon/libintercept.so.1.0 b/netcon/libintercept.so.1.0
index a2bc345b..a75d6ac0 100755
--- a/netcon/libintercept.so.1.0
+++ b/netcon/libintercept.so.1.0
Binary files differ