Commit 82b84a61 authored by 's avatar
Browse files

Renamed "statsto", as it (unfortunately) does not count with flow direction yet.

(Cheating at "old" CGI and NCURSES GUI for now, as I hope it will be solved soon.)


git-svn-id: file:///home/svn/mapi/trunk@1347 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 008a1d40
...@@ -148,8 +148,10 @@ struct thost { ...@@ -148,8 +148,10 @@ struct thost {
int fid_loss; // id of a function (EXPIREDR_FLOWS, BPF_FILTER) int fid_loss; // id of a function (EXPIREDR_FLOWS, BPF_FILTER)
int fid_load; // id of a function (BYTE_COUNTER) int fid_load; // id of a function (BYTE_COUNTER)
struct tstats stats; // stats struct tstats stats; // stats
struct tstats *statsto; // stats (to other hosts) struct tstats *statsrelto; // stats (in relation to other hosts)
struct tstats *oldstatsto; // old " struct tstats *statsdirto; // stats (in direction to other hosts)
struct tstats *oldstatsrelto; // old "
struct tstats *oldstatsdirto; // old "
struct tstats *stats_dev; // stats (for interfaces/devices) struct tstats *stats_dev; // stats (for interfaces/devices)
}; };
...@@ -352,17 +354,23 @@ int main(int argc, char *argv[]) ...@@ -352,17 +354,23 @@ int main(int argc, char *argv[])
// Initialize host arrays {{{ // Initialize host arrays {{{
for(h = 0; h < hosts; h++) { for(h = 0; h < hosts; h++) {
if((host[h].statsto = (struct tstats *) malloc(malloc_size = (hosts * sizeof(struct tstats)))) == NULL) { if((host[h].statsrelto = (struct tstats *) malloc(malloc_size = (hosts * sizeof(struct tstats)))) == NULL) {
fprintf(stderr, "malloc(): could not allocate memory"); fprintf(stderr, "malloc(): could not allocate memory");
return -1; return -1;
} }
memset(host[h].statsto, 0, malloc_size); memset(host[h].statsrelto, 0, malloc_size);
if((host[h].oldstatsto = (struct tstats *) malloc(malloc_size = (hosts * sizeof(struct tstats)))) == NULL) { // we do not recognize flow direction yet :(
host[h].statsdirto = host[h].statsrelto;
if((host[h].oldstatsrelto = (struct tstats *) malloc(malloc_size = (hosts * sizeof(struct tstats)))) == NULL) {
fprintf(stderr, "malloc(): could not allocate memory"); fprintf(stderr, "malloc(): could not allocate memory");
return -1; return -1;
} }
memset(host[h].oldstatsto, 0, malloc_size); memset(host[h].oldstatsrelto, 0, malloc_size);
// we do not recognize flow direction yet :(
host[h].oldstatsdirto = host[h].oldstatsrelto;
if((host[h].mapi_stats_dev = (struct mapi_stat *) malloc(malloc_size = (host[h].devices * sizeof(struct mapi_stat)))) == NULL) { if((host[h].mapi_stats_dev = (struct mapi_stat *) malloc(malloc_size = (host[h].devices * sizeof(struct mapi_stat)))) == NULL) {
fprintf(stderr, "malloc(): could not allocate memory"); fprintf(stderr, "malloc(): could not allocate memory");
...@@ -644,7 +652,7 @@ int main(int argc, char *argv[]) ...@@ -644,7 +652,7 @@ int main(int argc, char *argv[])
else { // FIXME else { // FIXME
for(h1 = 0; h1 < hosts; h1++) { for(h1 = 0; h1 < hosts; h1++) {
for(h2 = 0; h2 < hosts; h2++) { for(h2 = 0; h2 < hosts; h2++) {
if(h2 != h1) p += snprintf(p, 24, ":%f", (float) (h2 > h1 ? -1 : 1) * ((host[h1].statsto[h2].totalpk.loss - host[h1].oldstatsto[h2].totalpk.loss) * 100) / (float) (totalpk.count - old_totalpk.count)); if(h2 != h1) p += snprintf(p, 24, ":%f", (float) (h2 > h1 ? -1 : 1) * ((host[h1].statsrelto[h2].totalpk.loss - host[h1].oldstatsdirto[h2].totalpk.loss) * 100) / (float) (totalpk.count - old_totalpk.count));
} }
} }
} }
...@@ -662,7 +670,7 @@ int main(int argc, char *argv[]) ...@@ -662,7 +670,7 @@ int main(int argc, char *argv[])
else { // FIXME else { // FIXME
for(h1 = 0; h1 < hosts; h1++) { for(h1 = 0; h1 < hosts; h1++) {
for(h2 = 0; h2 < hosts; h2++) { for(h2 = 0; h2 < hosts; h2++) {
if(h2 != h1) p2 += snprintf(p2, 24, ":%f", (float) (h2 > h1 ? -1 : 1) * (host[h1].statsto[h2].totalpk.loss - host[h1].oldstatsto[h2].totalpk.loss)); if(h2 != h1) p2 += snprintf(p2, 24, ":%f", (float) (h2 > h1 ? -1 : 1) * (host[h1].statsrelto[h2].totalpk.loss - host[h1].oldstatsdirto[h2].totalpk.loss));
} }
} }
} }
...@@ -775,7 +783,7 @@ int main(int argc, char *argv[]) ...@@ -775,7 +783,7 @@ int main(int argc, char *argv[])
old_totalpk.loss = totalpk.loss; old_totalpk.loss = totalpk.loss;
for(h1 = 0; h1 < hosts; h1++) { for(h1 = 0; h1 < hosts; h1++) {
for(h2 = 0; h2 < hosts; h2++) { for(h2 = 0; h2 < hosts; h2++) {
if(h2 != h1) host[h1].oldstatsto[h2].totalpk.loss = host[h1].statsto[h2].totalpk.loss; if(h2 != h1) host[h1].oldstatsdirto[h2].totalpk.loss = host[h1].statsrelto[h2].totalpk.loss;
} }
} }
// }}} // }}}
...@@ -793,8 +801,8 @@ int main(int argc, char *argv[]) ...@@ -793,8 +801,8 @@ int main(int argc, char *argv[])
} else { } else {
mvprintw(row / 2 - 5, 8, "Total packet loss ratio : %.2f %% (%llu pkts)", (float) (totalpk.loss * 100) / (float) totalpk.count, totalpk.loss); mvprintw(row / 2 - 5, 8, "Total packet loss ratio : %.2f %% (%llu pkts)", (float) (totalpk.loss * 100) / (float) totalpk.count, totalpk.loss);
mvprintw(row / 2 - 4, 8, "Total byte loss ratio : %.2f %% (%.2f Kbytes)", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024)); mvprintw(row / 2 - 4, 8, "Total byte loss ratio : %.2f %% (%.2f Kbytes)", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024));
mvprintw(row / 2 - 1, 8, "Total packets lost from %s : %llu (%.2f %%)", host[0].name, host[0].statsto[1].totalpk.loss, (float) (host[0].statsto[1].totalpk.loss * 100) / (float) totalpk.count); mvprintw(row / 2 - 1, 8, "Total packets lost from %s : %llu (%.2f %%)", host[0].name, host[0].statsdirto[1].totalpk.loss, (float) (host[0].statsdirto[1].totalpk.loss * 100) / (float) totalpk.count);
mvprintw(row / 2, 8, "Total packets lost from %s : %llu (%.2f %%)", host[1].name, host[1].statsto[0].totalpk.loss, (float) (host[1].statsto[0].totalpk.loss * 100) / (float) totalpk.count); mvprintw(row / 2, 8, "Total packets lost from %s : %llu (%.2f %%)", host[1].name, host[1].statsdirto[0].totalpk.loss, (float) (host[1].statsdirto[0].totalpk.loss * 100) / (float) totalpk.count);
} }
mvprintw(row / 2 - 3, 8, "Total packets captured at host %s : %llu", host[0].name, host[0].stats.totalpk.count); mvprintw(row / 2 - 3, 8, "Total packets captured at host %s : %llu", host[0].name, host[0].stats.totalpk.count);
mvprintw(row / 2 - 2, 8, "Total packets captured at host %s : %llu", host[1].name, host[1].stats.totalpk.count); mvprintw(row / 2 - 2, 8, "Total packets captured at host %s : %llu", host[1].name, host[1].stats.totalpk.count);
...@@ -843,20 +851,20 @@ int main(int argc, char *argv[]) ...@@ -843,20 +851,20 @@ int main(int argc, char *argv[])
//TODO fprintf(fp, "top;blr1h;Last Hour Byte Loss Ratio;%.2f %% (%.2f Kbytes);\n", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024)); //TODO fprintf(fp, "top;blr1h;Last Hour Byte Loss Ratio;%.2f %% (%.2f Kbytes);\n", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024));
fprintf(fp, "\n"); fprintf(fp, "\n");
for(h1 = 0; h1 < hosts; h1++) { for(h1 = 0; h1 < hosts; h1++) {
fprintf(fp, "top;tfch%d;Total flows captured at host %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.count); fprintf(fp, "top;tfch%d;Total flows captured at %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.count);
fprintf(fp, "top;tfmh%d;Total flows matched at host %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.matched); fprintf(fp, "top;tfmh%d;Total flows matched at %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.matched);
fprintf(fp, "top;tfuh%d;Total flows unmatched at host %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.unmatched); fprintf(fp, "top;tfuh%d;Total flows unmatched at %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.unmatched);
fprintf(fp, "top;tfth%d;Total flows timeouted at host %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.timeouted); fprintf(fp, "top;tfth%d;Total flows timeouted at %s;%u\n", h1, host[h1].name, host[h1].stats.totalflows.timeouted);
fprintf(fp, "top;tpch%d;Total packets captured at host %s;%llu\n", h1, host[h1].name, host[h1].stats.totalpk.count); fprintf(fp, "top;tpch%d;Total packets captured at %s;%llu\n", h1, host[h1].name, host[h1].stats.totalpk.count);
for(d = 0; d < host[h1].devices; d++) { for(d = 0; d < host[h1].devices; d++) {
fprintf(fp, "top;tpch%dd%d;Total packets captured at host %s:%s;%llu\n", h1, d, host[h1].name, host[h1].mapi_stats_dev[d].dev, host[h1].stats_dev[d].totalpk.count); fprintf(fp, "top;tpch%dd%d;Total packets captured at %s:%s;%llu\n", h1, d, host[h1].name, host[h1].mapi_stats_dev[d].dev, host[h1].stats_dev[d].totalpk.count);
} }
for(h2 = 0; h2 < hosts; h2++) { for(h2 = 0; h2 < hosts; h2++) {
if(h2 != h1) { if(h2 != h1) {
fprintf(fp, "top;tfmh%dh%d;Total flows matched at host %s to host %s;%u\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsto[h2].totalflows.matched); fprintf(fp, "top;tfmrh%dh%d;Total flows matched at %s in relation to %s;%u\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsrelto[h2].totalflows.matched);
fprintf(fp, "top;tfth%dh%d;Total flows timeouted at host %s to host %s;%u\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsto[h2].totalflows.timeouted); fprintf(fp, "top;tftrh%dh%d;Total flows timeouted at %s in relation to %s;%u\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsrelto[h2].totalflows.timeouted);
fprintf(fp, "top;tpmh%dh%d;Total packets matched at host %s to host %s;%llu\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsto[h2].totalpk.matched); fprintf(fp, "top;tpmrh%dh%d;Total packets matched at %s in relation to %s;%llu\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsrelto[h2].totalpk.matched);
fprintf(fp, "top;tplh%dh%d;Total packets lost from %s to %s;%llu (%.2f %%)\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsto[h2].totalpk.loss, (float)(totalpk.count ? (host[h1].statsto[h2].totalpk.loss * 100) / (float) totalpk.count: totalpk.count)); fprintf(fp, "top;tplrh%dh%d;Total packets lost at %s in relation to %s;%llu (%.2f %%)\n", h1, h2, host[h1].name, host[h2].name, host[h1].statsrelto[h2].totalpk.loss, (float)(totalpk.count ? (host[h1].statsrelto[h2].totalpk.loss * 100) / (float) totalpk.count: totalpk.count));
fprintf(fp, "\n"); fprintf(fp, "\n");
} }
} }
...@@ -898,13 +906,13 @@ int main(int argc, char *argv[]) ...@@ -898,13 +906,13 @@ int main(int argc, char *argv[])
fprintf(fp, "<center> Last 1 Month Packet Loss Ratio : %.2f %% (%llu pkts)<br>\n", (float) (onemonth.pkcount ? (onemonth.pkloss * 100) / (float) onemonth.pkcount : onemonth.pkcount), onemonth.pkloss); fprintf(fp, "<center> Last 1 Month Packet Loss Ratio : %.2f %% (%llu pkts)<br>\n", (float) (onemonth.pkcount ? (onemonth.pkloss * 100) / (float) onemonth.pkcount : onemonth.pkcount), onemonth.pkloss);
fprintf(fp, "<center> Last 1 Year Packet Loss Ratio : %.2f %% (%llu pkts)<br><hr>\n", (float) (oneyear.pkcount ? (oneyear.pkloss * 100) / (float) oneyear.pkcount : oneyear.pkcount), oneyear.pkloss); fprintf(fp, "<center> Last 1 Year Packet Loss Ratio : %.2f %% (%llu pkts)<br><hr>\n", (float) (oneyear.pkcount ? (oneyear.pkloss * 100) / (float) oneyear.pkcount : oneyear.pkcount), oneyear.pkloss);
//TODO fprintf(fp, "<center> Last Hour Byte Loss Ratio : %.2f %% (%.2f Kbytes)<br><hr>\n", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024)); //TODO fprintf(fp, "<center> Last Hour Byte Loss Ratio : %.2f %% (%.2f Kbytes)<br><hr>\n", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024));
fprintf(fp, "<center> Total packets lost from <font color='#00FF00'><b>%s</b></font> : %llu (%.2f %%) <br>\n", host[0].name, host[0].statsto[1].totalpk.loss, (float)(totalpk.count ? (host[0].statsto[1].totalpk.loss * 100) / (float) totalpk.count: totalpk.count)); fprintf(fp, "<center> Total packets lost from <font color='#00FF00'><b>%s</b></font> : %llu (%.2f %%) <br>\n", host[0].name, host[0].statsdirto[1].totalpk.loss, (float)(totalpk.count ? (host[0].statsdirto[1].totalpk.loss * 100) / (float) totalpk.count: totalpk.count));
fprintf(fp, "<center> Total packets lost from <font color=\"#0066FF\"><b>%s</b></font> : %llu (%.2f %%) <br><hr>\n", host[1].name, host[1].statsto[0].totalpk.loss, (float) (totalpk.count ? (host[1].statsto[0].totalpk.loss * 100) / (float) totalpk.count : totalpk.count)); fprintf(fp, "<center> Total packets lost from <font color=\"#0066FF\"><b>%s</b></font> : %llu (%.2f %%) <br><hr>\n", host[1].name, host[1].statsdirto[0].totalpk.loss, (float) (totalpk.count ? (host[1].statsdirto[0].totalpk.loss * 100) / (float) totalpk.count : totalpk.count));
fprintf(fp, "<center> Total packets captured at host <font color=\"#00FF00\"><b>%s</b></font> : %llu <br>\n", host[0].name, host[0].stats.totalpk.count); fprintf(fp, "<center> Total packets captured at host <font color=\"#00FF00\"><b>%s</b></font> : %llu <br>\n", host[0].name, host[0].stats.totalpk.count);
fprintf(fp, "<center> Total packets captured at host <font color=\"#0066FF\"><b>%s</b></font> : %llu <br><hr>\n", host[1].name, host[1].stats.totalpk.count); fprintf(fp, "<center> Total packets captured at host <font color=\"#0066FF\"><b>%s</b></font> : %llu <br><hr>\n", host[1].name, host[1].stats.totalpk.count);
fprintf(fp, "<center> Total packets matched at host <font color=\"#00FF00\"><b>%s</b></font> : %llu <br>\n", host[0].name, host[0].statsto[1].totalpk.matched); fprintf(fp, "<center> Total packets matched at host <font color=\"#00FF00\"><b>%s</b></font> : %llu <br>\n", host[0].name, host[0].statsdirto[1].totalpk.matched);
fprintf(fp, "<center> Total packets matched at host <font color=\"#0066FF\"><b>%s</b></font> : %llu <br><hr>\n", host[1].name, host[1].statsto[0].totalpk.matched); fprintf(fp, "<center> Total packets matched at host <font color=\"#0066FF\"><b>%s</b></font> : %llu <br><hr>\n", host[1].name, host[1].statsdirto[0].totalpk.matched);
fprintf(fp, "<center><i><u>Network Load</u></i> : %f Mbit/s<br><hr>\n", speed); fprintf(fp, "<center><i><u>Network Load</u></i> : %f Mbit/s<br><hr>\n", speed);
fprintf(fp, "</div><div id='protocolstable' ><center><table border=\"0\" width=75%% bgcolor=\"#999999\" cellpadding=\"1\" cellspacing=\"1\" class=style9>\n"); fprintf(fp, "</div><div id='protocolstable' ><center><table border=\"0\" width=75%% bgcolor=\"#999999\" cellpadding=\"1\" cellspacing=\"1\" class=style9>\n");
...@@ -1015,8 +1023,8 @@ void terminate() ...@@ -1015,8 +1023,8 @@ void terminate()
} else { } else {
printf("\nTotal Packet Loss Ratio : %.2f %% (%llu pkts)\n", (float) (totalpk.loss * 100) / (float) totalpk.count, totalpk.loss); printf("\nTotal Packet Loss Ratio : %.2f %% (%llu pkts)\n", (float) (totalpk.loss * 100) / (float) totalpk.count, totalpk.loss);
printf("Total Byte Loss Ratio : %.2f %% (%.2f Kbytes)\n", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024)); printf("Total Byte Loss Ratio : %.2f %% (%.2f Kbytes)\n", (float) (totalbytes.lost * 100) / (float) totalbytes.count, (float) (totalbytes.lost / (float) 1024));
printf("Total packets lost from %s : %llu (%.2f %%)\n", host[0].name, host[0].statsto[1].totalpk.loss, (float) (host[0].statsto[1].totalpk.loss * 100) / (float) totalpk.count); printf("Total packets lost from %s : %llu (%.2f %%)\n", host[0].name, host[0].statsdirto[1].totalpk.loss, (float) (host[0].statsdirto[1].totalpk.loss * 100) / (float) totalpk.count);
printf("Total packets lost from %s : %llu (%.2f %%)\n", host[1].name, host[1].statsto[0].totalpk.loss, (float) (host[1].statsto[0].totalpk.loss * 100) / (float) totalpk.count); printf("Total packets lost from %s : %llu (%.2f %%)\n", host[1].name, host[1].statsdirto[0].totalpk.loss, (float) (host[1].statsdirto[0].totalpk.loss * 100) / (float) totalpk.count);
} }
printf("Total packets captured at host %s : %llu\n", host[0].name, host[0].stats.totalpk.count); printf("Total packets captured at host %s : %llu\n", host[0].name, host[0].stats.totalpk.count);
printf("Total packets captured at host %s : %llu\n", host[1].name, host[1].stats.totalpk.count); printf("Total packets captured at host %s : %llu\n", host[1].name, host[1].stats.totalpk.count);
...@@ -1069,13 +1077,11 @@ void drop_old_and_unassigned_flows(void) ...@@ -1069,13 +1077,11 @@ void drop_old_and_unassigned_flows(void)
while (tmp != NULL) { while (tmp != NULL) {
next = tmp->next; next = tmp->next;
if ((current_ts - tmp->data.timestamp > ((unsigned long long) (TIMEOUT)) << 32) || !tmp->assigned) { if ((current_ts - tmp->data.timestamp > ((unsigned long long) (TIMEOUT)) << 32)) {
if(!tmp->assigned) { // if ((current_ts - tmp->data.timestamp > ((unsigned long long) (TIMEOUT)) << 32) || !tmp->assigned) {
host[tmp->sensor].stats.totalflows.unmatched++; if(tmp->assigned) {
}
else {
host[tmp->sensor].stats.totalflows.timeouted++; host[tmp->sensor].stats.totalflows.timeouted++;
host[tmp->sensor].statsto[tmp->sensor2].totalflows.timeouted++; host[tmp->sensor].statsrelto[tmp->sensor2].totalflows.timeouted++;
} }
if (LOGFILE) { if (LOGFILE) {
...@@ -1169,8 +1175,8 @@ unsigned long long cmp_results(struct flow_data *data, unsigned int sensor) ...@@ -1169,8 +1175,8 @@ unsigned long long cmp_results(struct flow_data *data, unsigned int sensor)
if(flowathost[currenthost]->sensor != sensor) {fprintf(stderr, "packetloss: ERROR sensor!=sensor\n"); exit(EXIT_FAILURE); } if(flowathost[currenthost]->sensor != sensor) {fprintf(stderr, "packetloss: ERROR sensor!=sensor\n"); exit(EXIT_FAILURE); }
if(flowathost[currenthost]->sensor2 == sensor) {fprintf(stderr, "packetloss: ERROR sensor2==sensor\n"); exit(EXIT_FAILURE); } if(flowathost[currenthost]->sensor2 == sensor) {fprintf(stderr, "packetloss: ERROR sensor2==sensor\n"); exit(EXIT_FAILURE); }
matchedsensor = flowathost[currenthost]->sensor2; matchedsensor = flowathost[currenthost]->sensor2;
host[sensor].statsto[matchedsensor].totalpk.matched += flowathost[currenthost]->data.packets_count; host[sensor].statsrelto[matchedsensor].totalpk.matched += flowathost[currenthost]->data.packets_count;
host[matchedsensor].statsto[sensor].totalpk.matched += flowathost[otherhost]->data.packets_count; host[matchedsensor].statsrelto[sensor].totalpk.matched += flowathost[otherhost]->data.packets_count;
// set the-host-which-looses as "looser" // set the-host-which-looses as "looser"
looser = (flowathost[0]->data.packets_count > flowathost[1]->data.packets_count); looser = (flowathost[0]->data.packets_count > flowathost[1]->data.packets_count);
...@@ -1187,7 +1193,7 @@ unsigned long long cmp_results(struct flow_data *data, unsigned int sensor) ...@@ -1187,7 +1193,7 @@ unsigned long long cmp_results(struct flow_data *data, unsigned int sensor)
} }
pkloss = flowathost[winner]->data.packets_count - flowathost[looser]->data.packets_count; // packet loss pkloss = flowathost[winner]->data.packets_count - flowathost[looser]->data.packets_count; // packet loss
// store stats -- now or never // store stats -- now or never
host[loosersensor].statsto[winnersensor].totalpk.loss += pkloss; host[loosersensor].statsrelto[winnersensor].totalpk.loss += pkloss;
if (sport == 2233 || dport == 2233) mapi.pkts += flowathost[winner]->data.packets_count; if (sport == 2233 || dport == 2233) mapi.pkts += flowathost[winner]->data.packets_count;
else if (sport == 1194 || dport == 1194) openvpn.pkts += flowathost[winner]->data.packets_count; else if (sport == 1194 || dport == 1194) openvpn.pkts += flowathost[winner]->data.packets_count;
...@@ -1292,12 +1298,12 @@ void store_results(unsigned int sensor, unsigned int count, struct flow_data *fl ...@@ -1292,12 +1298,12 @@ void store_results(unsigned int sensor, unsigned int count, struct flow_data *fl
// tmp2->sensor2 = tmp->sensor; // with tmp->sensor // tmp2->sensor2 = tmp->sensor; // with tmp->sensor
// tmp2->assigned = 1; // tmp2->assigned = 1;
// host[tmp2->sensor].stats.totalflows.matched++; // host[tmp2->sensor].stats.totalflows.matched++;
// host[tmp2->sensor].statsto[tmp->sensor].totalflows.matched++; // host[tmp2->sensor].statsrelto[tmp->sensor].totalflows.matched++;
// } // }
// tmp->assigned = 1; // assign the existing flow // tmp->assigned = 1; // assign the existing flow
// tmp->sensor2 = tmp2->sensor; // with sensor2 // tmp->sensor2 = tmp2->sensor; // with sensor2
// host[tmp->sensor].stats.totalflows.matched++; // host[tmp->sensor].stats.totalflows.matched++;
// host[tmp->sensor].statsto[tmp2->sensor].totalflows.matched++; // host[tmp->sensor].statsrelto[tmp2->sensor].totalflows.matched++;
// } // }
// } // }
} }
...@@ -1315,7 +1321,7 @@ void store_results(unsigned int sensor, unsigned int count, struct flow_data *fl ...@@ -1315,7 +1321,7 @@ void store_results(unsigned int sensor, unsigned int count, struct flow_data *fl
tmp->assigned = 1; tmp->assigned = 1;
host[tmp->sensor].stats.totalflows.unmatched--; host[tmp->sensor].stats.totalflows.unmatched--;
host[tmp->sensor].stats.totalflows.matched++; host[tmp->sensor].stats.totalflows.matched++;
host[tmp->sensor].statsto[sensor].totalflows.matched++; host[tmp->sensor].statsrelto[sensor].totalflows.matched++;
} }
assigned = 1; // shall assign the new flow soon assigned = 1; // shall assign the new flow soon
sensor2 = tmp->sensor; // with sensor2 sensor2 = tmp->sensor; // with sensor2
...@@ -1341,7 +1347,7 @@ void store_results(unsigned int sensor, unsigned int count, struct flow_data *fl ...@@ -1341,7 +1347,7 @@ void store_results(unsigned int sensor, unsigned int count, struct flow_data *fl
if(assigned) { if(assigned) {
host[sensor].stats.totalflows.matched++; host[sensor].stats.totalflows.matched++;
host[sensor].statsto[sensor2].totalflows.matched++; host[sensor].statsrelto[sensor2].totalflows.matched++;
} }
else { else {
host[sensor].stats.totalflows.unmatched++; host[sensor].stats.totalflows.unmatched++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment