Skip to Content.
Sympa Menu

ndt-users - Re: failed middlebox testing

Subject: ndt-users list created

List archive

Re: failed middlebox testing


Chronological Thread 
  • From: Mike Iglesias <>
  • To:
  • Cc:
  • Subject: Re: failed middlebox testing
  • Date: Tue, 30 Aug 2005 08:57:05 -0700

What architecture are you running on? ndt has some issues with the
results of time() on x86_64 that may be causing problems for you.
If the log file for fakewww has weird dates in it, you're probably
seeing this problem.

I've included the patches I sent to Rich Carlson below. No guarantee
they're completely correct, but it did fix the weird date issue for us.


Mike Iglesias Email:

University of California, Irvine phone: 949-824-6926
Network & Academic Computing Services FAX: 949-824-2069

--- src/fakewww.c.dist 2004-07-15 09:59:56.000000000 -0700
+++ src/fakewww.c 2005-06-30 12:22:59.000000000 -0700
@@ -18,7 +18,7 @@
/* #include <getopt.h> */
#include <unistd.h>
/* #include <config.h> */
-
+#include <time.h>

#define PORT 7123
#define BUFFSIZE 1024
@@ -56,6 +56,7 @@
int reap(), c;
int n, sockfd, newsockfd, clilen, childpid, servlen;
int federated=0, debug=0, max_ttl=10, i;
+ time_t tt;

char *LogFileName=NULL, *ctime();
struct sockaddr_in cli_addr, serv_addr;
@@ -110,10 +111,10 @@

clilen = sizeof(cli_addr);
getsockname(sockfd, (struct sockaddr *)&cli_addr, &clilen);
- i = time(0);
+ tt = time(0);
if (debug > 0) {
fprintf(stderr, "%15.15s server started, listening on port %d",
- ctime(&i)+4, ntohs(cli_addr.sin_port));
+ ctime(&tt)+4, ntohs(cli_addr.sin_port));
if (federated == 1)
fprintf(stderr, ", operating in Federated mode");
fprintf(stderr, "\n");
@@ -122,7 +123,7 @@
fp = fopen(LogFileName, "a");
if (fp != NULL) {
fprintf(fp, "%15.15s server started, listening on port %d",
- ctime(&i)+4, ntohs(cli_addr.sin_port));
+ ctime(&tt)+4, ntohs(cli_addr.sin_port));
if (federated == 1)
fprintf(fp, ", operating in Federated mode");
fprintf(fp, "\n");
@@ -254,7 +255,8 @@
u_int32_t IPlist[64], srv_addr;
FILE *lfd;
struct sockaddr_in serv_addr;
-
+ time_t tt;
+
while ((n = readline(sd, buff, sizeof(buff))) > 0){
buff[n] = '\0';
if (n < 3)
@@ -344,12 +346,12 @@
srv_addr & 0xff, (srv_addr >> 8) & 0xff,
(srv_addr >> 16) & 0xff, (srv_addr >> 24)
& 0xff, port);
}
- i = time(0);
+ tt = time(0);
if (LogFileName != NULL) {
lfd = fopen(LogFileName, "a");
if (lfd != NULL) {
fprintf(lfd, "%15.15s [%s] redirected to
remote server [%u.%u.%u.%u:%d]\n",
- ctime(&i)+4,
inet_ntoa(cli_addr.sin_addr),
+ ctime(&tt)+4,
inet_ntoa(cli_addr.sin_addr),
srv_addr & 0xff, (srv_addr >> 8) &
0xff,
(srv_addr >> 16) & 0xff, (srv_addr >>
24) & 0xff, port);

@@ -361,15 +363,15 @@
}

/* try to open and give em what they want */
- i = time(0);
+ tt = time(0);
writen(sd, MsgOK, strlen(MsgOK));
if (debug > 2)
- fprintf(stderr, "%15.15s [%s] requested file '%s' - ",
ctime(&i)+4,
+ fprintf(stderr, "%15.15s [%s] requested file '%s' - ",
ctime(&tt)+4,
inet_ntoa(cli_addr.sin_addr), filename);
if (LogFileName != NULL) {
lfd = fopen(LogFileName, "a");
if (lfd != NULL) {
- fprintf(lfd, "%15.15s [%s] requested file '%s' - ",
ctime(&i)+4,
+ fprintf(lfd, "%15.15s [%s] requested file '%s' - ",
ctime(&tt)+4,
inet_ntoa(cli_addr.sin_addr), filename);
fclose(lfd);
}
--- src/web100-util.c.dist 2004-12-30 10:34:56.000000000 -0800
+++ src/web100-util.c 2005-06-30 12:33:39.000000000 -0700
@@ -112,6 +112,7 @@
char buf[32], line[256], *ctime();
web100_group* group;
FILE *fp;
+ time_t tt;

cn = local_find_connection(sock, agent, debug);

@@ -119,9 +120,9 @@
/* sprintf(line, "RemoteIPaddress: %s\n", inet_ntoa(peeraddr.sin_addr));
* write(ctlsock, line, strlen(line));
*/
- i=time(0);
+ tt=time(0);
fp=fopen(LogFileName,"a");
- fprintf(fp,"%15.15s;", ctime(&i)+4);
+ fprintf(fp,"%15.15s;", ctime(&tt)+4);
web100_agent_find_var_and_group(agent, "RemAddress", &group, &var);
web100_raw_read(var, cn, buf);
sprintf(line, "%s;", web100_value_to_text(web100_get_var_type(var), buf));
--- src/web100srv.h.dist 2004-08-10 08:30:12.000000000 -0700
+++ src/web100srv.h 2005-06-30 13:06:38.000000000 -0700
@@ -64,8 +64,8 @@
int pid;
char addr[64];
char host[256];
- int stime;
- int qtime;
+ time_t stime;
+ time_t qtime;
int pipe;
int ctlsockfd;
struct ndtchild *next;
--- src/web100srv.c.dist 2005-03-14 13:05:12.000000000 -0800
+++ src/web100srv.c 2005-07-05 14:23:33.000000000 -0700
@@ -1,3 +1,4 @@
+
/*
Copyright © 2003 University of Chicago. All rights reserved.
The Web100 Network Diagnostic Tool (NDT) is distributed subject to
@@ -626,9 +627,10 @@
int index, links[16], max, total;
int c2sdata, c2sack, s2cdata, s2cack;
int spd_sock, spd_sock2, spdfd, j, i, rc;
- int mon_pid1, mon_pid2, totalcnt, spd, stime;
+ int mon_pid1, mon_pid2, totalcnt, spd;
int seg_size, win_size;
int autotune, rbuff, sbuff, k;
+ time_t stime;

double loss, rttsec, bw, rwin, swin, cwin, speed;
double rwintime, cwndtime, sendtime;
@@ -1360,7 +1362,7 @@
fd_set rfd;
struct timeval sel_tv;
struct ndtchild *tmp_ptr, *new_child;
-
+ time_t tt;

opterr = 0;
while ((c = getopt(argc, argv, "adxhmoqrstvb:c:p:f:i:l:")) != -1){
@@ -1545,14 +1547,14 @@

/* create a log file entry every time the web100srv process starts
up. */
ndtpid = getpid();
- c = time(0);
+ tt = time(0);
fp = fopen(LogFileName,"a");
if (fp == NULL)
fprintf(stderr, "Unable to open log file '%s', continuing on
without logging\n",
LogFileName);
else {
fprintf(fp, "Web100srv (ver %s) process (%d) started %15.15s\n",
- VERSION, ndtpid, ctime(&c)+4);
+ VERSION, ndtpid, ctime(&tt)+4);
fclose(fp);
}
if (usesyslog == 1)
@@ -1604,17 +1606,17 @@
if (debug > 2)
fprintf(stderr, "Waiting for new connection, timer
running\n");
rc = select(sockfd+1, &rfd, NULL, NULL, &sel_tv);
- c = time(0);
+ tt = time(0);
if (head_ptr != NULL) {
if (debug > 2)
fprintf(stderr, "now = %d Process started at %d,
run time = %d\n",
- c, head_ptr->stime, (c -
head_ptr->stime));
- if (c - head_ptr->stime > 60) {
+ tt, head_ptr->stime, (tt -
head_ptr->stime));
+ if (tt - head_ptr->stime > 60) {
/* process is stuck at the front of the queue. */
fp = fopen(LogFileName,"a");
if (fp != NULL) {
fprintf(fp, "%d children waiting in queue:
Killing off stuck process %d at %15.15s\n",
- waiting, head_ptr->pid, ctime(&c)+4);
+ waiting, head_ptr->pid, ctime(&tt)+4);
fclose(fp);
}
tmp_ptr = head_ptr->next;
@@ -1665,7 +1667,7 @@
continue;
}
new_child = (struct ndtchild *) malloc(sizeof(struct
ndtchild));
- i = time(0);
+ tt = time(0);
hp = gethostbyaddr(&cli_addr.sin_addr, sizeof(struct
in_addr), AF_INET);
name = (hp == NULL) ? inet_ntoa(cli_addr.sin_addr) :
hp->h_name;
rmt_host = inet_ntoa(cli_addr.sin_addr);
@@ -1705,8 +1707,8 @@
new_child->pid = chld_pid;
strcpy(new_child->addr, rmt_host);
strcpy(new_child->host, name);
- new_child->stime = i + (waiting*45);
- new_child->qtime = i;
+ new_child->stime = tt + (waiting*45);
+ new_child->qtime = tt;
new_child->pipe = chld_pipe[1];
new_child->ctlsockfd = ctlsockfd;
new_child->next = NULL;
@@ -1850,7 +1852,7 @@
LogFileName);
else {
fprintf(fp,"%15.15s %s port %d\n",
- ctime(&i)+4, name, ntohs(cli_addr.sin_port));
+ ctime(&tt)+4, name, ntohs(cli_addr.sin_port));
fclose(fp);
}
close(chld_pipe[0]);



Archive powered by MHonArc 2.6.16.

Top of Page