Browse Source

getsockopt() tweak

Joseph Henry 9 years ago
parent
commit
fde8af9483
2 changed files with 13 additions and 5 deletions
  1. 11 5
      netcon/Intercept.c
  2. 2 0
      netcon/NetconEthernetTap.cpp

+ 11 - 5
netcon/Intercept.c

@@ -159,6 +159,7 @@ static int get_retval()
     if(n_read > 0) {
     if(n_read > 0) {
       memcpy(&retval, &retbuf[1], sizeof(retval));
       memcpy(&retval, &retbuf[1], sizeof(retval));
       memcpy(&errno, &retbuf[1+sizeof(retval)], sizeof(errno));
       memcpy(&errno, &retbuf[1+sizeof(retval)], sizeof(errno));
+      dwr(MSG_DEBUG, "get_retval(): ret = %d\n", retval);
       return retval;
       return retval;
     }
     }
   }
   }
@@ -403,23 +404,28 @@ int getsockopt(GETSOCKOPT_SIG)
     return -1;
     return -1;
   }
   }
   dwr(MSG_DEBUG,"getsockopt(%d)\n", sockfd);
   dwr(MSG_DEBUG,"getsockopt(%d)\n", sockfd);
-  /*
-  if(is_mapped_to_service(sockfd) < 0) { // First, check if the service manages this
+  
+  if(is_mapped_to_service(sockfd) <= 0) { // First, check if the service manages this
     return realgetsockopt(sockfd, level, optname, optval, optlen);
     return realgetsockopt(sockfd, level, optname, optval, optlen);
   }
   }
-  */
-  int err = realgetsockopt(sockfd, level, optname, optval, optlen);
+  //return 0;
+
+
+  //int err = realgetsockopt(sockfd, level, optname, optval, optlen);
   /* TODO: this condition will need a little more intelligence later on
   /* TODO: this condition will need a little more intelligence later on
    -- we will need to know if this fd is a local we are spoofing, or a true local */
    -- we will need to know if this fd is a local we are spoofing, or a true local */
+  
   if(optname == SO_TYPE)
   if(optname == SO_TYPE)
   {
   {
     int* val = (int*)optval;
     int* val = (int*)optval;
     *val = 2;
     *val = 2;
     optval = (void*)val;
     optval = (void*)val;
   }
   }
+  /*
   if(err < 0){
   if(err < 0){
-    perror("setsockopt():\n");
+    perror("getsockopt():\n");
   }
   }
+  */
   return 0;
   return 0;
 }
 }
 
 

+ 2 - 0
netcon/NetconEthernetTap.cpp

@@ -440,6 +440,8 @@ void NetconEthernetTap::die(int exret) {
  */
  */
 void NetconEthernetTap::closeConnection(TcpConnection *conn)
 void NetconEthernetTap::closeConnection(TcpConnection *conn)
 {
 {
+	//return;
+	//dwr(MSG_DEBUG, "closeConnection(): conn = 0x%x\n", conn);
 	if(!conn)
 	if(!conn)
 		return;
 		return;
 	dwr(MSG_DEBUG, " closeConnection(%x, %d)\n", conn->pcb, _phy.getDescriptor(conn->dataSock));
 	dwr(MSG_DEBUG, " closeConnection(%x, %d)\n", conn->pcb, _phy.getDescriptor(conn->dataSock));