Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r1183 committed - Issue165: Fixed retrieving client IP address

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r1183 committed - Issue165: Fixed retrieving client IP address


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r1183 committed - Issue165: Fixed retrieving client IP address
  • Date: Tue, 17 Feb 2015 13:41:07 +0000

Revision: 1183
Author:

Date: Tue Feb 17 13:40:44 2015 UTC
Log: Issue165: Fixed retrieving client IP address

https://code.google.com/p/ndt/source/detail?r=1183

Modified:
/branches/Issue165/src/web100srv.c

=======================================
--- /branches/Issue165/src/web100srv.c Thu Nov 20 00:29:27 2014 UTC
+++ /branches/Issue165/src/web100srv.c Tue Feb 17 13:40:44 2015 UTC
@@ -136,9 +136,10 @@
static int syslogfacility = LOG_FACILITY;
static char *ConfigFileName = NULL;
static char buff[BUFFSIZE + 1];
-static char*rmt_host;
+static char rmt_host[256];
+static char rmt_addr[256];
static char *device = NULL;
-static char* port = PORT;
+static char *port = PORT;
static TestOptions testopt;

static int conn_options = 0;
@@ -1262,9 +1263,9 @@
get_ISOtime(isoTime, sizeof(isoTime)));

log_println(9, "meta.date=%s, meta.clientip =%s:%s:%d", meta.date,
- meta.client_ip, rmt_host, strlen(rmt_host));
- memcpy(meta.client_ip, rmt_host, strlen(rmt_host));
- log_println(9, "2. meta.clientip =%s:%s:%d", meta.client_ip, rmt_host);
+ meta.client_ip, rmt_addr, strlen(rmt_addr));
+ memcpy(meta.client_ip, rmt_addr, strlen(rmt_addr));
+ log_println(9, "2. meta.clientip =%s:%s:%d", meta.client_ip, rmt_addr);

memset(tmpstr, 0, sizeof(tmpstr));
snprintf(tmpstr, sizeof(tmpstr), "%d,%d,%d,%"VARtype",%"VARtype",%"
@@ -2184,12 +2185,15 @@
memcpy(&meta.c_addr, &cli_addr, clilen);
meta.family = ((struct sockaddr *) &cli_addr)->sa_family;

- size_t tmpstrlen = sizeof(tmpstr);
- memset(tmpstr, 0, tmpstrlen);
+ memset(rmt_addr, 0, sizeof(rmt_addr));
// get addr details based on socket info available
I2Addr tmp_addr = I2AddrBySockFD(get_errhandle(), ctlsockfd,
False);
- I2AddrNodeName(tmp_addr, tmpstr, &tmpstrlen);
+ addr2a(&cli_addr, rmt_addr, sizeof(rmt_addr));
+
+ size_t rmt_host_strlen = sizeof(rmt_host);
+ memset(rmt_host, 0, rmt_host_strlen);
+ I2AddrNodeName(tmp_addr, rmt_host, &rmt_host_strlen);
/* I2AddrFree(tmp_addr); */
log_println(4,
"New connection received from 0x%x [%s] sockfd=%d.",
@@ -2245,9 +2249,7 @@
new_child = (struct ndtchild *) malloc(sizeof(struct ndtchild));
memset(new_child, 0, sizeof(struct ndtchild));
tt = time(0);
- name = tmpstr;
-
- rmt_host = tmpstr;
+ name = rmt_host;

// At this point we have received a connection from a client,
// meaning that a test is being requested. At this point we should


  • [ndt-dev] [ndt] r1183 committed - Issue165: Fixed retrieving client IP address, ndt, 02/17/2015

Archive powered by MHonArc 2.6.16.

Top of Page