File traffic-vis-0.35-warnings-fix.diff of Package traffic-vis
--- collector/summary-output.c
+++ collector/summary-output.c
@@ -57,7 +57,7 @@
oinfo.out = fopen(summary_file, "w");
if (oinfo.out == NULL)
{
- syslog(LOG_CRIT, "Unable to open output file '%s': %m");
+ syslog(LOG_CRIT, "Unable to open output file '%s': %m", summary_file);
return;
}
oinfo.peers = p->peers;
@@ -67,9 +67,9 @@
fprintf(oinfo.out, "START_TIME\t%lu\n", p->summary_start);
fprintf(oinfo.out, "FINISH_TIME\t%lu\n", p->summary_finish);
fprintf(oinfo.out, "TOTAL_HOSTS\t%u\n", p->active_hosts);
- fprintf(oinfo.out, "TOTAL_BYTES\t%llu\n", p->total_bytes);
- fprintf(oinfo.out, "TOTAL_PACKETS\t%llu\n", p->total_packets);
- fprintf(oinfo.out, "TOTAL_CONREQS\t%llu\n", p->total_connections);
+ fprintf(oinfo.out, "TOTAL_BYTES\t%llu\n", (unsigned long long int) p->total_bytes);
+ fprintf(oinfo.out, "TOTAL_PACKETS\t%llu\n", (unsigned long long int) p->total_packets);
+ fprintf(oinfo.out, "TOTAL_CONREQS\t%llu\n", (unsigned long long int) p->total_connections);
fprintf(oinfo.out, "\n");
g_hash_table_foreach(p->hosts, (GHFunc)print_host, (gpointer)&oinfo);
@@ -85,12 +85,12 @@
fprintf(oinfo->out, "NEW_HOST\n");
fprintf(oinfo->out, "\tHOST_ADDR\t%s\n", inet_ntoa(i));
- fprintf(oinfo->out, "\tHOST_BYTES_SENT\t%llu\n", host->bytes_sent);
- fprintf(oinfo->out, "\tHOST_BYTES_RECEIVED\t%llu\n", host->bytes_received);
- fprintf(oinfo->out, "\tHOST_PACKETS_SENT\t%llu\n", host->packets_sent);
- fprintf(oinfo->out, "\tHOST_PACKETS_RECEIVED\t%llu\n", host->packets_received);
- fprintf(oinfo->out, "\tHOST_CONREQS_SENT\t%llu\n", host->connections_sent);
- fprintf(oinfo->out, "\tHOST_CONREQS_RECEIVED\t%llu\n", host->connections_received);
+ fprintf(oinfo->out, "\tHOST_BYTES_SENT\t%llu\n", (unsigned long long int) host->bytes_sent);
+ fprintf(oinfo->out, "\tHOST_BYTES_RECEIVED\t%llu\n", (unsigned long long int) host->bytes_received);
+ fprintf(oinfo->out, "\tHOST_PACKETS_SENT\t%llu\n", (unsigned long long int) host->packets_sent);
+ fprintf(oinfo->out, "\tHOST_PACKETS_RECEIVED\t%llu\n", (unsigned long long int) host->packets_received);
+ fprintf(oinfo->out, "\tHOST_CONREQS_SENT\t%llu\n", (unsigned long long int) host->connections_sent);
+ fprintf(oinfo->out, "\tHOST_CONREQS_RECEIVED\t%llu\n", (unsigned long long int) host->connections_received);
fprintf(oinfo->out, "\tHOST_FIRST_TRAFFIC_TIME\t%lu\n", host->first_seen);
fprintf(oinfo->out, "\tHOST_LAST_TRAFFIC_TIME\t%lu\n", host->last_seen);
@@ -114,7 +114,7 @@
peer = g_hash_table_lookup(peers, (gpointer)&(peer_keys[c]));
if (peer == NULL)
{
- syslog(LOG_CRIT, "Missing peer record for key %lli", peer_keys[c]);
+ syslog(LOG_CRIT, "Missing peer record for key %lli", (unsigned long long int) peer_keys[c]);
raise(SIGSEGV);
}
@@ -128,9 +128,9 @@
fprintf(out, "\tNEW_PEER\n");
fprintf(out, "\t\tPEER_SRC_ADDR\t%s\n", host1_addr);
fprintf(out, "\t\tPEER_DST_ADDR\t%s\n", host2_addr);
- fprintf(out, "\t\tPEER_BYTES\t%llu\n", peer->bytes_sent_1_to_2);
- fprintf(out, "\t\tPEER_PACKETS\t%llu\n", peer->packets_sent_1_to_2);
- fprintf(out, "\t\tPEER_CONREQS\t%llu\n", peer->connections_sent_1_to_2);
+ fprintf(out, "\t\tPEER_BYTES\t%llu\n", (unsigned long long int) peer->bytes_sent_1_to_2);
+ fprintf(out, "\t\tPEER_PACKETS\t%llu\n", (unsigned long long int) peer->packets_sent_1_to_2);
+ fprintf(out, "\t\tPEER_CONREQS\t%llu\n", (unsigned long long int) peer->connections_sent_1_to_2);
fprintf(out, "\tEND_PEER\n");
}
@@ -139,9 +139,9 @@
fprintf(out, "\tNEW_PEER\n");
fprintf(out, "\t\tPEER_SRC_ADDR\t%s\n", host2_addr);
fprintf(out, "\t\tPEER_DST_ADDR\t%s\n", host1_addr);
- fprintf(out, "\t\tPEER_BYTES\t%llu\n", peer->bytes_sent_2_to_1);
- fprintf(out, "\t\tPEER_PACKETS\t%llu\n", peer->packets_sent_2_to_1);
- fprintf(out, "\t\tPEER_CONREQS\t%llu\n", peer->connections_sent_2_to_1);
+ fprintf(out, "\t\tPEER_BYTES\t%llu\n", (unsigned long long int) peer->bytes_sent_2_to_1);
+ fprintf(out, "\t\tPEER_PACKETS\t%llu\n", (unsigned long long int) peer->packets_sent_2_to_1);
+ fprintf(out, "\t\tPEER_CONREQS\t%llu\n", (unsigned long long int) peer->connections_sent_2_to_1);
fprintf(out, "\tEND_PEER\n");
}
}
--- frontends/htmlfe.c
+++ frontends/htmlfe.c
@@ -123,7 +123,7 @@
</TR>\n\
</TABLE>\n\
<BR>\n\
-", r->active_hosts, r->total_bytes, r->total_packets, r->total_connections);
+", r->active_hosts, (unsigned long long int) r->total_bytes, (unsigned long long int) r->total_packets, (unsigned long long int) r->total_connections);
h = r->hosts;
while(h != NULL)
@@ -189,7 +189,7 @@
%llu\n\
</TD>\n\
</TR>\
-", host->bytes_sent, host->bytes_received);
+", (unsigned long long int) host->bytes_sent, (unsigned long long int) host->bytes_received);
fprintf(out, "\
<TR>\n\
@@ -203,7 +203,7 @@
%llu\n\
</TD>\n\
</TR>\n\
-", host->packets_sent, host->packets_received);
+", (unsigned long long int) host->packets_sent, (unsigned long long int) host->packets_received);
fprintf(out, "\
<TR>\n\
@@ -217,7 +217,7 @@
%llu\n\
</TD>\n\
</TR>\n\
-", host->connections_sent, host->connections_received);
+", (unsigned long long int) host->connections_sent, (unsigned long long int) host->connections_received);
fprintf(out, "\
<TR>\n\
@@ -271,7 +271,7 @@
<TD ALIGN=\"RIGHT\">%llu</TD>\n\
<TD ALIGN=\"RIGHT\">%llu</TD>\n\
</TR>\n\
-", src_hostname, dst_hostname, peers->bytes_sent, peers->packets_sent);
+", src_hostname, dst_hostname, (unsigned long long int) peers->bytes_sent, (unsigned long long int) peers->packets_sent);
peers = peers->next;
}
--- frontends/textfe.c
+++ frontends/textfe.c
@@ -80,9 +80,9 @@
}
fprintf(out, "Total active hosts: %u\n", r->active_hosts);
- fprintf(out, "Total bytes: %llu\n", r->total_bytes);
- fprintf(out, "Total packets: %llu\n", r->total_packets);
- fprintf(out, "Total connection requests: %llu\n", r->total_connections);
+ fprintf(out, "Total bytes: %llu\n", (unsigned long long int) r->total_bytes);
+ fprintf(out, "Total packets: %llu\n", (unsigned long long int)r->total_packets);
+ fprintf(out, "Total connection requests: %llu\n", (unsigned long long int)r->total_connections);
fprintf(out, "\n");
}
@@ -96,9 +96,9 @@
if (h->n_peers != 0)
print_peers(out, h->peers);
- fprintf(out, " [ %llu bytes sent, %llu bytes received ]\n", h->bytes_sent, h->bytes_received);
- fprintf(out, " [ %llu packets sent, %llu packets received ]\n", h->packets_sent, h->packets_received);
- fprintf(out, " [ %llu connection requests sent, %llu connection requests received ]\n", h->connections_sent, h->connections_received);
+ fprintf(out, " [ %llu bytes sent, %llu bytes received ]\n", (unsigned long long int) h->bytes_sent, (unsigned long long int) h->bytes_received);
+ fprintf(out, " [ %llu packets sent, %llu packets received ]\n",(unsigned long long int) h->packets_sent,(unsigned long long int) h->packets_received);
+ fprintf(out, " [ %llu connection requests sent, %llu connection requests received ]\n", (unsigned long long int) h->connections_sent, (unsigned long long int) h->connections_received);
fprintf(out, " [ First traffic recorded at %s ]\n", format_time(h->first_seen));
fprintf(out, " [ Last traffic recorded at %s ]\n", format_time(h->last_seen));
@@ -116,7 +116,7 @@
format_hostname(p->dst, dst_hostname, sizeof(dst_hostname));
fprintf(out, "\t%s -> %s (%llu bytes, %llu packets)\n",
- src_hostname, dst_hostname, p->bytes_sent, p->packets_sent);
+ src_hostname, dst_hostname, (unsigned long long int) p->bytes_sent, (unsigned long long int) p->packets_sent);
p = p->next;
}
--- frontends/traffic-togif
+++ frontends/traffic-togif
@@ -27,6 +27,9 @@
use strict;
use Getopt::Long;
+sub Version();
+sub Usage();
+
my $x_size = 750;
my $y_size = 750;
--- read-report.c
+++ read-report.c
@@ -173,7 +173,7 @@
items = sscanf(buffer, " %s %s", key, value);
if ((items < 1) || (items > 2))
{
- fprintf(stderr, "Parse error at report line %llu.\n", line);
+ fprintf(stderr, "Parse error at report line %llu.\n", (unsigned long long int)line);
fclose(report_h);
return(NULL);
}
@@ -189,7 +189,7 @@
/* If match, execute action - check for success */
if (!parser_tags[c].action(value))
{
- fprintf(stderr, "Parse error at report line %llu.\n", line);
+ fprintf(stderr, "Parse error at report line %llu.\n", (unsigned long long int)line);
fclose(report_h);
return(NULL);
}
@@ -201,7 +201,7 @@
/* Report error if key not found */
if (parser_tags[c].tag == NULL)
{
- fprintf(stderr, "Parse error at report line %llu.\n", line);
+ fprintf(stderr, "Parse error at report line %llu.\n",(unsigned long long int) line);
fclose(report_h);
return(NULL);
}
@@ -426,13 +426,15 @@
static int set_host_bytes_received(const char *value)
{
- /* Ensure that there is a current host entry */
+ unsigned long long int received;
+ /* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%llu", &(host->bytes_received)) != 1)
+ if (sscanf(value, "%llu", &received) != 1)
return(0);
-
+
+ host->bytes_received = (u_int64_t) received;
#ifdef DEBUG
fprintf(stderr, "Host bytes received: %llu\n", host->bytes_received);
#endif /* DEBUG */
@@ -442,13 +444,15 @@
static int set_host_bytes_sent(const char *value)
{
+ unsigned long long int sent;
+
/* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%llu", &(host->bytes_sent)) != 1)
+ if (sscanf(value, "%llu",&sent) != 1)
return(0);
-
+ host->bytes_sent = (u_int64_t) sent;
#ifdef DEBUG
fprintf(stderr, "Host bytes sent: %llu\n", host->bytes_sent);
#endif /* DEBUG */
@@ -458,13 +462,14 @@
static int set_host_conreqs_received(const char *value)
{
+ unsigned long long int received;
/* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%llu", &(host->connections_received)) != 1)
+ if (sscanf(value, "%llu", &received) != 1)
return(0);
-
+ host->connections_received = (u_int64_t) received;
#ifdef DEBUG
fprintf(stderr, "Host conreq received: %llu\n", host->connections_received);
#endif /* DEBUG */
@@ -474,12 +479,14 @@
static int set_host_conreqs_sent(const char *value)
{
+ unsigned long long int sent;
/* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%llu", &(host->connections_sent)) != 1)
+ if (sscanf(value, "%llu", &sent ) != 1)
return(0);
+ host->connections_sent = (u_int64_t) sent;
#ifdef DEBUG
fprintf(stderr, "Host conreq sent: %llu\n", host->connections_sent);
@@ -490,13 +497,14 @@
static int set_host_first_traffic_time(const char *value)
{
+ long long int seen;
/* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%ld", &(host->first_seen)) != 1)
+ if (sscanf(value, "%ld", &seen) != 1)
return(0);
-
+ host->first_seen = (int64_t) seen;
#ifdef DEBUG
fprintf(stderr, "Host first traffic: %s", ctime(&(host->first_seen)));
#endif /* DEBUG */
@@ -506,13 +514,14 @@
static int set_host_last_traffic_time(const char *value)
{
+ long long int seen;
/* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%ld", &(host->last_seen)) != 1)
+ if (sscanf(value, "%ld", &seen) != 1)
return(0);
-
+ host->last_seen = (int64_t) seen;
#ifdef DEBUG
fprintf(stderr, "Host last traffic: %s", ctime(&(host->last_seen)));
#endif /* DEBUG */
@@ -533,13 +542,14 @@
static int set_host_packets_received(const char *value)
{
+ long long int received;
/* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%lld", &(host->packets_received)) != 1)
+ if (sscanf(value, "%lld", &received) != 1)
return(0);
-
+ host->packets_received = (int64_t) received;
#ifdef DEBUG
fprintf(stderr, "Host packets received: %s\n", value);
#endif /* DEBUG */
@@ -549,13 +559,14 @@
static int set_host_packets_sent(const char *value)
{
+ long long int sent;
/* Ensure that there is a current host entry */
if (host == NULL)
return(0);
- if (sscanf(value, "%lld", &(host->packets_sent)) != 1)
+ if (sscanf(value, "%lld", &sent) != 1)
return(0);
-
+ host->packets_sent = (int64_t) sent;
#ifdef DEBUG
fprintf(stderr, "Host packets sent: %s\n", value);
#endif /* DEBUG */
@@ -622,13 +633,14 @@
static int set_peer_bytes(const char *value)
{
+ long long int sent;
/* Ensure there is a current peer entry */
if (peer == NULL)
return(0);
- if (sscanf(value, "%lld", &(peer->bytes_sent)) != 1)
+ if (sscanf(value, "%lld", &sent) != 1)
return(0);
-
+ peer->bytes_sent = (int64_t) sent;
#ifdef DEBUG
fprintf(stderr, "Peer bytes: %llu\n", peer->bytes_sent);
#endif /* DEBUG */
@@ -638,13 +650,14 @@
static int set_peer_conreqs(const char *value)
{
+ long long int sent;
/* Ensure there is a current peer entry */
if (peer == NULL)
return(0);
- if (sscanf(value, "%lld", &(peer->connections_sent)) != 1)
+ if (sscanf(value, "%lld",&sent) != 1)
return(0);
-
+ peer->connections_sent = (int64_t) sent;
#ifdef DEBUG
fprintf(stderr, "Peer conreqs: %llu\n", peer->connections_sent);
#endif /* DEBUG */
@@ -654,13 +667,14 @@
static int set_peer_packets(const char *value)
{
+ long long int sent;
/* Ensure there is a current peer entry */
if (peer == NULL)
return(0);
- if (sscanf(value, "%lld", &(peer->packets_sent)) != 1)
+ if (sscanf(value, "%lld",&sent) != 1)
return(0);
-
+ peer->packets_sent = (int64_t) sent;
#ifdef DEBUG
fprintf(stderr, "Peer packets: %llu\n", peer->packets_sent);
#endif /* DEBUG */
@@ -679,9 +693,10 @@
static int set_total_bytes(const char *value)
{
- if (sscanf(value, "%lld", &(report->total_bytes)) != 1)
+ long long int total;
+ if (sscanf(value, "%lld", &total) != 1)
return(0);
-
+ report->total_bytes = (int64_t) total;
#ifdef DEBUG
fprintf(stderr, "Total bytes: %llu\n", report->total_bytes);
#endif /* DEBUG */
@@ -691,9 +706,10 @@
static int set_total_conreqs(const char *value)
{
- if (sscanf(value, "%lld", &(report->total_connections)) != 1)
+ long long int total;
+ if (sscanf(value, "%lld", &total) != 1)
return(0);
-
+ report->total_connections = (int64_t) total;
#ifdef DEBUG
fprintf(stderr, "Total conreqs: %llu\n", report->total_connections);
#endif /* DEBUG */
@@ -715,9 +731,10 @@
static int set_total_packets(const char *value)
{
- if (sscanf(value, "%lld", &(report->total_packets)) != 1)
+ long long int total;
+ if (sscanf(value, "%lld", &total) != 1)
return(0);
-
+ report->total_packets = (int64_t) total;
#ifdef DEBUG
fprintf(stderr, "Total packets: %llu\n", report->total_packets);
#endif /* DEBUG */
--- write-report.c
+++ write-report.c
@@ -74,9 +74,9 @@
fprintf(out, "START_TIME\t%lu\n", r->summary_start);
fprintf(out, "FINISH_TIME\t%lu\n", r->summary_finish);
fprintf(out, "TOTAL_HOSTS\t%u\n", r->active_hosts);
- fprintf(out, "TOTAL_BYTES\t%llu\n", r->total_bytes);
- fprintf(out, "TOTAL_PACKETS\t%llu\n", r->total_packets);
- fprintf(out, "TOTAL_CONREQS\t%llu\n", r->total_connections);
+ fprintf(out, "TOTAL_BYTES\t%llu\n",(unsigned long long int) r->total_bytes);
+ fprintf(out, "TOTAL_PACKETS\t%llu\n",(unsigned long long int) r->total_packets);
+ fprintf(out, "TOTAL_CONREQS\t%llu\n",(unsigned long long int) r->total_connections);
fprintf(out, "\n");
if (!write_hosts(r->hosts, out))
@@ -97,14 +97,14 @@
i.s_addr = h->ip_addr;
fprintf(out, "NEW_HOST\n");
fprintf(out, "\tHOST_ADDR\t%s\n", inet_ntoa(i));
- fprintf(out, "\tHOST_BYTES_SENT\t%llu\n", h->bytes_sent);
- fprintf(out, "\tHOST_BYTES_RECEIVED\t%llu\n", h->bytes_received);
+ fprintf(out, "\tHOST_BYTES_SENT\t%llu\n", (unsigned long long int) h->bytes_sent);
+ fprintf(out, "\tHOST_BYTES_RECEIVED\t%llu\n", (unsigned long long int) h->bytes_received);
if (h->hostname != NULL)
fprintf(out, "\tHOST_NAME\t%s\n", h->hostname);
- fprintf(out, "\tHOST_PACKETS_SENT\t%llu\n", h->packets_sent);
- fprintf(out, "\tHOST_PACKETS_RECEIVED\t%llu\n", h->packets_received);
+ fprintf(out, "\tHOST_PACKETS_SENT\t%llu\n", (unsigned long long int) h->packets_sent);
+ fprintf(out, "\tHOST_PACKETS_RECEIVED\t%llu\n",(unsigned long long int) h->packets_received);
fprintf(out, "\tHOST_CONREQS_SENT\t%llu\n", h->connections_sent);
- fprintf(out, "\tHOST_CONREQS_RECEIVED\t%llu\n", h->connections_received);
+ fprintf(out, "\tHOST_CONREQS_RECEIVED\t%llu\n",(unsigned long long int) h->connections_received);
fprintf(out, "\tHOST_FIRST_TRAFFIC_TIME\t%lu\n", h->first_seen);
fprintf(out, "\tHOST_LAST_TRAFFIC_TIME\t%lu\n", h->last_seen);
@@ -136,9 +136,9 @@
fprintf(out, "\tNEW_PEER\n");
fprintf(out, "\t\tPEER_SRC_ADDR\t%s\n", host1_addr);
fprintf(out, "\t\tPEER_DST_ADDR\t%s\n", host2_addr);
- fprintf(out, "\t\tPEER_BYTES\t%llu\n", p->bytes_sent);
- fprintf(out, "\t\tPEER_PACKETS\t%llu\n", p->packets_sent);
- fprintf(out, "\t\tPEER_CONREQS\t%llu\n", p->connections_sent);
+ fprintf(out, "\t\tPEER_BYTES\t%llu\n", (unsigned long long int) p->bytes_sent);
+ fprintf(out, "\t\tPEER_PACKETS\t%llu\n", (unsigned long long int) p->packets_sent);
+ fprintf(out, "\t\tPEER_CONREQS\t%llu\n", (unsigned long long int) p->connections_sent);
fprintf(out, "\tEND_PEER\n");
p = p->next;