summaryrefslogtreecommitdiff
path: root/netcon
diff options
context:
space:
mode:
Diffstat (limited to 'netcon')
-rw-r--r--netcon/Intercept.c16
-rw-r--r--netcon/NetconEthernetTap.cpp16
-rw-r--r--netcon/README.md36
-rw-r--r--netcon/common.inc.c2
4 files changed, 37 insertions, 33 deletions
diff --git a/netcon/Intercept.c b/netcon/Intercept.c
index 51ab53d4..8e5391ef 100644
--- a/netcon/Intercept.c
+++ b/netcon/Intercept.c
@@ -135,9 +135,7 @@ static int init_service_connection()
strncpy(rpcname,network_id,sizeof(rpcname));
instance_count++;
- rpcfd = rpc_join(rpcname);
- fprintf(stderr, "rpc_join = %d\n", rpcfd);
- return rpcfd;
+ return rpc_join(rpcname);
}
/*------------------------------------------------------------------------------
@@ -152,7 +150,7 @@ static void my_dest(void) {
static void load_symbols(void)
{
- if(thispid == getpid()) {
+ if(thispid == getpid()) {
dwr(MSG_DEBUG,"detected duplicate call to global constructor (pid=%d).\n", thispid);
}
thispid = getpid();
@@ -276,15 +274,6 @@ int socket(SOCKET_SIG)
errno = EINVAL;
return -1;
}
- /* Check that we haven't hit the soft-limit file descriptors allowed */
- /* FIXME: Find number of open fds
- struct rlimit rl;
- getrlimit(RLIMIT_NOFILE, &rl);
- if(sockfd >= rl.rlim_cur){
- errno = EMFILE;
- return -1;
- }
- */
/* TODO: detect ENFILE condition */
if(socket_family == AF_LOCAL
@@ -338,7 +327,6 @@ int connect(CONNECT_SIG)
return -1;
}
dwr(MSG_DEBUG,"connect(%d):\n", __fd);
- /* print_addr(__addr); */
struct sockaddr_in *connaddr;
connaddr = (struct sockaddr_in *) __addr;
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp
index 9dd888ba..59c021e1 100644
--- a/netcon/NetconEthernetTap.cpp
+++ b/netcon/NetconEthernetTap.cpp
@@ -440,16 +440,9 @@ void NetconEthernetTap::die(int exret) {
*/
void NetconEthernetTap::closeConnection(TcpConnection *conn)
{
- //return;
- //dwr(MSG_DEBUG, "closeConnection(): conn = 0x%x\n", conn);
if(!conn)
return;
dwr(MSG_DEBUG, " closeConnection(%x, %d)\n", conn->pcb, _phy.getDescriptor(conn->dataSock));
- //lwipstack->_tcp_sent(conn->pcb, NULL);
- //lwipstack->_tcp_recv(conn->pcb, NULL);
- //lwipstack->_tcp_err(conn->pcb, NULL);
- //lwipstack->_tcp_poll(conn->pcb, NULL, 0);
- //lwipstack->_tcp_arg(conn->pcb, NULL);
if(lwipstack->_tcp_close(conn->pcb) != ERR_OK) {
dwr(MSG_ERROR, " closeConnection(): Error while calling tcp_close()\n");
exit(0);
@@ -876,7 +869,7 @@ err_t NetconEthernetTap::nc_recved(void *arg, struct tcp_pcb *tpcb, struct pbuf
if(!l->conn) {
dwr(MSG_ERROR, " nc_recved(): no connection object\n");
- return ERR_OK; // ?
+ return ERR_OK;
}
if(p == NULL) {
if(l->conn && !l->conn->listening) {
@@ -892,7 +885,7 @@ err_t NetconEthernetTap::nc_recved(void *arg, struct tcp_pcb *tpcb, struct pbuf
q = p;
while(p != NULL) { // Cycle through pbufs and write them to the socket
if(p->len <= 0)
- break; // ?
+ break;
if((n = l->tap->_phy.streamSend(l->conn->dataSock,p->payload, p->len)) > 0) {
if(n < p->len) {
dwr(MSG_INFO, " nc_recved(): unable to write entire pbuf to buffer\n");
@@ -993,7 +986,7 @@ void NetconEthernetTap::nc_err(void *arg, err_t err)
break;
}
dwr(MSG_ERROR, "nc_err(): closing connection\n");
- l->tap->closeConnection(l->conn);
+ l->tap->closeConnection(l->conn);
}
/*
@@ -1024,12 +1017,9 @@ 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)
{
- //dwr(5, " nc_sent()\n");
Larg *l = (Larg*)arg;
if(len) {
l->conn->acked+=len;
- //dwr("W = %d, A = %d\n", l->conn->written, l->conn->acked);
- //dwr("ACK = %d\n", len);
l->tap->_phy.setNotifyReadable(l->conn->dataSock, true);
l->tap->_phy.whack();
}
diff --git a/netcon/README.md b/netcon/README.md
index 3de020d2..908a6c41 100644
--- a/netcon/README.md
+++ b/netcon/README.md
@@ -21,11 +21,37 @@ The virtual TCP/IP stack will respond to *incoming* ICMP ECHO requests, which me
The following applications have been tested and confirmed to work for the beta release:
- sshd [ WORKS as of 20151215 ] Fedora 22/23, Centos 7, Ubuntu 14.04
- apache [ WORKS as of 20151215 ] 2.4.6 on Centos 7, 2.4.16 and 2.4.17 on Fedora 22/23
- nginx [ WORKS as of 20151215 ] 1.8.0 on both Fedora 22/23 and Ubuntu 14.04
- nodejs [ WORKS as of 20151215 ] 4.2.2, 6.0.0-pre (note: some older LTS versions are known to have a connection accept bug)
- redis-server [ WORKS as of 20151215 ] 3.0.4 on Fedora 22/23
+Fedora 23:
+
+ httpstub.c
+ nginx 1.8.0
+ http 2.4.16, 2.4.17
+ darkhttpd 1.11
+ python 2.7.10 (python -m SimpleHTTPServer)
+ python 3.4.3 (python -m http.server)
+ redis 3.0.4
+ node 6.0.0-pre
+ sshd
+
+CentOS 7:
+
+ httpstub.c
+ nginx 1.6.3
+ httpd (debug mode -X)
+ darkhttpd 1.11
+ node 4.2.2
+ redis 2.8.19
+ sshd
+
+Ubuntu 14.04.3:
+
+ httpstub.c
+ nginx 1.4.6
+ python 2.7.6 (python -m SimpleHTTPServer)
+ python 3.4.0 (python -m http.server)
+ node 5.2.0
+ redis 2.8.4
+ sshd
It is *likely* to work with other things but there are no guarantees.
diff --git a/netcon/common.inc.c b/netcon/common.inc.c
index 29632e63..858a2195 100644
--- a/netcon/common.inc.c
+++ b/netcon/common.inc.c
@@ -42,7 +42,7 @@
#ifndef _COMMON_H
#define _COMMON_H 1
-#define DEBUG_LEVEL 4
+#define DEBUG_LEVEL 0
#define MSG_WARNING 4
#define MSG_ERROR 1 // Errors