Various bug reports from Bertrand Petit: mostly compilation warnings

and documentation.
Initial
Stephane Bortzmeyer 20 years ago
parent 90752a3b40
commit aea0ea51ac

@ -5,6 +5,11 @@
supported via plugins. Consequences: supported via plugins. Consequences:
- you now need an Unix with a working dlopen(3) - you now need an Unix with a working dlopen(3)
- echoping now requires the popt parsing library - echoping now requires the popt parsing library
* popt: echoping now depends on popt. One main change: options
parsing is lightly different so some scripts *may* break. A
typical example is that "old-school" Unix aggreation of arguments
("echoping -v4 localhost") is no longer accepted (use "echoping -v
-4 localhost").
5.2.0 (2004-02-29) 5.2.0 (2004-02-29)

@ -58,6 +58,12 @@ check first that you use the FQDN of the server on the command line
(this is a consequence of the HTTP 1.1 protocol, not a bug in echoping (this is a consequence of the HTTP 1.1 protocol, not a bug in echoping
and this will show only if the HTTP server uses "virtual hosting"). and this will show only if the HTTP server uses "virtual hosting").
The SSL support (with OpenSSL *or* GNU TLS) is not established by
default, mostly because cryptography software's status is still
unclear in some countries. You have to use --with-ssl (which should be
--with--openssl, I know, there are two libraries, with incompatible
APIs) or --with-gnutls
************* Bug reports *********************** ************* Bug reports ***********************
To report a bug, email Stephane Bortzmeyer To report a bug, email Stephane Bortzmeyer

@ -127,13 +127,15 @@ or
(depending on your Unix). /usr/include/netinet/ip.h may contain (depending on your Unix). /usr/include/netinet/ip.h may contain
interesting constants for setting Type Of Service. interesting constants for setting Type Of Service.
.IP -m\ plugin .IP -m\ plugin
Load the given plugin. Quite experimental. The plugin is first Load the given plugin. The plugin is first
searched in the normal library directories (see searched in the normal library directories (see
.BR ld.so(8) .BR ld.so(8)
) then in @plugins_dir@. The documentation for a ) then in @plugins_dir@. You can type
.BR ls
in @plugins_dir@ to get an idea of the available plugins. The documentation for a
given plugin is in given plugin is in
.BR echoping_PLUGINNAME(1) .BR echoping_PLUGINNAME(1)
. The plugin-specific options appear The plugin-specific options appear
.B after .B after
the hostname. the hostname.
.SH EXAMPLES .SH EXAMPLES

@ -48,7 +48,7 @@ main (argc, argv)
int remaining = argc; int remaining = argc;
char **leftover; char **leftover;
int sockfd; int sockfd = -1;
struct addrinfo hints, hints_numeric, *res; struct addrinfo hints, hints_numeric, *res;
int error; int error;
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
@ -76,17 +76,17 @@ main (argc, argv)
void printstats (); void printstats ();
#ifdef HAVE_USLEEP #ifdef HAVE_USLEEP
double wait = 1.0; float wait = 1.0;
#else #else
unsigned int wait = 1; unsigned int wait = 1;
#endif #endif
unsigned char fill = ' '; unsigned char fill = ' ';
unsigned int fill_i; char *fill_s;
boolean fill_requested = 0; boolean fill_requested = FALSE;
unsigned int i = 0; unsigned int i = 0;
char *plugin_name, *complete_plugin_name = NULL; char *plugin_name, *complete_plugin_name = NULL;
char *ext; char *ext;
void *plugin; void *plugin = NULL;
int plugin_result; int plugin_result;
void to_alarm (); /* our alarm() signal handler */ void to_alarm (); /* our alarm() signal handler */
@ -100,7 +100,7 @@ main (argc, argv)
#endif #endif
char *plugin_port_name, *port_name; char *plugin_port_name, *port_name;
boolean plugin_raw; boolean plugin_raw = FALSE;
boolean port_to_use = USE_ECHO; boolean port_to_use = USE_ECHO;
boolean http = 0; boolean http = 0;
boolean smtp = 0; boolean smtp = 0;
@ -147,35 +147,41 @@ main (argc, argv)
{"verbose", 'v', POPT_ARG_NONE, &verbose, 'v'}, {"verbose", 'v', POPT_ARG_NONE, &verbose, 'v'},
{"help", '?', POPT_ARG_NONE, NULL, '?'}, {"help", '?', POPT_ARG_NONE, NULL, '?'},
{"size", 's', POPT_ARG_INT, &size, 's'}, {"size", 's', POPT_ARG_INT, &size, 's'},
{"number", 'n', POPT_ARG_INT, &number, 'n'}, {"number", 'n', POPT_ARG_INT, &number, 'n', "Number of iterations"},
#ifdef HAVE_USLEEP #ifdef HAVE_USLEEP
{"wait", 'w', POPT_ARG_FLOAT, &wait, 'w'}, {"wait", 'w', POPT_ARG_FLOAT, &wait, 'w', "Delay between iterations"},
#else #else
{"wait", 'w', POPT_ARG_INT, &wait, 'w'}, {"wait", 'w', POPT_ARG_INT, &wait, 'w', "Delay between iterations"},
#endif #endif
{"discard", 'd', POPT_ARG_NONE, &discard, 'd'}, {"discard", 'd', POPT_ARG_NONE, &discard, 'd'},
{"chargen", 'c', POPT_ARG_NONE, &chargen, 'c'}, {"chargen", 'c', POPT_ARG_NONE, &chargen, 'c'},
{"http", 'h', POPT_ARG_STRING, &url, 'h'}, {"http", 'h', POPT_ARG_STRING, &url, 'h'},
{"icp", 'i', POPT_ARG_STRING, &url, 'i'}, {"icp", 'i', POPT_ARG_STRING, &url, 'i',
{"ttcp", 'r', POPT_ARG_NONE, &ttcp, 'r'}, "ICP protocol, for Web proxies/caches"},
{"ttcp", 'r', POPT_ARG_NONE, &ttcp, 'r',
"Use the T/TCP protocol (Transaction TCP)"},
{"udp", 'u', POPT_ARG_NONE, &udp, 'u'}, {"udp", 'u', POPT_ARG_NONE, &udp, 'u'},
{"timeout", 't', POPT_ARG_INT, &timeout, 't'}, {"timeout", 't', POPT_ARG_INT, &timeout, 't'},
{"fill", 'f', POPT_ARG_INT, &fill_i, 'f'}, {"fill", 'f', POPT_ARG_STRING, &fill_s, 'f'},
{"smtp", 'S', POPT_ARG_NONE, &smtp, 'S'}, {"smtp", 'S', POPT_ARG_NONE, &smtp, 'S'},
{"ssl", 'C', POPT_ARG_NONE, &ssl, 'C'}, {"ssl", 'C', POPT_ARG_NONE, &ssl, 'C'},
{"priority", 'p', POPT_ARG_INT, &priority, 'p'}, {"priority", 'p', POPT_ARG_INT, &priority, 'p'},
{"type-of-service", 'P', POPT_ARG_INT, &tos, 'P'}, {"type-of-service", 'P', POPT_ARG_INT, &tos, 'P'},
{"check-original", 'a', POPT_ARG_NONE, NULL, 'a'}, {"check-original", 'a', POPT_ARG_NONE, NULL, 'a',
{"ignore-cache", 'A', POPT_ARG_NONE, NULL, 'A'}, "For HTTP through a proxy/cache"},
{"ignore-cache", 'A', POPT_ARG_NONE, NULL, 'A',
"For HTTP through a proxy/cache"},
{"ipv4", '4', POPT_ARG_NONE, NULL, '4'}, {"ipv4", '4', POPT_ARG_NONE, NULL, '4'},
{"ipv6", '6', POPT_ARG_NONE, NULL, '6'}, {"ipv6", '6', POPT_ARG_NONE, NULL, '6'},
{"module", 'm', POPT_ARG_STRING, &plugin_name, 'm'}, {"module", 'm', POPT_ARG_STRING, &plugin_name, 'm',
"Loads the given plugin"},
POPT_TABLEEND POPT_TABLEEND
}; };
poptContext poptcon; poptContext poptcon;
global_options.udp = 0; global_options.udp = FALSE;
global_options.verbose = 0; global_options.ttcp = FALSE;
global_options.verbose = FALSE;
null_timeval.tv_sec = 0; null_timeval.tv_sec = 0;
null_timeval.tv_usec = 0; null_timeval.tv_usec = 0;
@ -216,6 +222,9 @@ main (argc, argv)
case '?': case '?':
poptPrintHelp (poptcon, stdout, 0); poptPrintHelp (poptcon, stdout, 0);
fprintf (stdout, " hostname [plugin-options...]\n"); fprintf (stdout, " hostname [plugin-options...]\n");
fprintf (stdout,
" (You can get a list of available plugins with \"ls %s\")\n",
PLUGINS_DIR);
exit (0); exit (0);
case 'v': case 'v':
break; break;
@ -255,7 +264,9 @@ main (argc, argv)
break; break;
case 'f': case 'f':
remaining--; remaining--;
fill = (char) fill_i; if (strlen (fill_s) > 1)
err_quit ("Argument --fill should be a one-character string");
fill = fill_s[0];
fill_requested = 1; fill_requested = 1;
break; break;
case 'S': case 'S':
@ -444,7 +455,7 @@ main (argc, argv)
sprintf (plugin_name, "%s.so", plugin_name); sprintf (plugin_name, "%s.so", plugin_name);
plugin = dlopen (plugin_name, RTLD_NOW); plugin = dlopen (plugin_name, RTLD_NOW);
if (!plugin) if (!plugin)
{ {
/* Retries with the absolute name */ /* Retries with the absolute name */
complete_plugin_name = (char *) malloc (MAX_LINE); complete_plugin_name = (char *) malloc (MAX_LINE);
sprintf (complete_plugin_name, "%s/%s", PLUGINS_DIR, plugin_name); sprintf (complete_plugin_name, "%s/%s", PLUGINS_DIR, plugin_name);
@ -462,6 +473,7 @@ main (argc, argv)
err_sys ("Cannot find init in %s: %s", plugin_name, dlerror ()); err_sys ("Cannot find init in %s: %s", plugin_name, dlerror ());
} }
global_options.udp = udp; global_options.udp = udp;
global_options.ttcp = ttcp;
global_options.verbose = verbose; global_options.verbose = verbose;
if (family == AF_INET) if (family == AF_INET)
global_options.only_ipv4 = 1; global_options.only_ipv4 = 1;
@ -725,9 +737,10 @@ main (argc, argv)
} }
else else
{ {
sendline = (char *) malloc (size); sendline = (char *) malloc (size + 1);
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
sendline[i] = fill; sendline[i] = fill;
sendline[size] = 0;
} }
n = strlen (sendline); n = strlen (sendline);

@ -128,6 +128,7 @@ boolean timeout_flag;
struct echoping_struct struct echoping_struct
{ {
boolean udp; /* Use the UDP protocol (TCP is the default) */ boolean udp; /* Use the UDP protocol (TCP is the default) */
boolean ttcp;
boolean only_ipv4; boolean only_ipv4;
boolean only_ipv6; boolean only_ipv6;
boolean verbose; boolean verbose;

@ -52,7 +52,7 @@ make_http_sendline (char *url, char *host, int port, int nocache)
int int
read_from_server (CHANNEL fs, short ssl) read_from_server (CHANNEL fs, short ssl)
{ {
int nr; int nr = 0;
int total = 0; int total = 0;
char reply_code; char reply_code;
int first_line = TRUE; int first_line = TRUE;

@ -14,7 +14,7 @@ random_string (unsigned length)
{ {
char *state = (char *) malloc (sizeof (char) * STATES); char *state = (char *) malloc (sizeof (char) * STATES);
char *result = (char *) malloc (length); char *result = (char *) malloc (length + 1);
int i, number; int i, number;
unsigned seed = (unsigned) time ((time_t *) NULL); unsigned seed = (unsigned) time ((time_t *) NULL);

Loading…
Cancel
Save