Commit 0359367d authored by pdw's avatar pdw

Minor bug fixes:

- direction allocation in promisc mode with no net setting
- aggregate protocols if port display is turned off.
parent 3dcbe7a6
......@@ -181,7 +181,7 @@ static void handle_ip_packet(struct ip* iptr, int hw_dir)
* it was picked up in promisc mode, and account it as incoming.
*/
else if(iptr->ip_src.s_addr < iptr->ip_dst.s_addr) {
assign_addr_pair(&ap, iptr, 0);
assign_addr_pair(&ap, iptr, 1);
direction = 0;
}
else {
......
......@@ -69,9 +69,12 @@ void readable_size(float n, char* buf, int bsize, int ksize, int bytes) {
if(n >= ksize * ksize) {
snprintf(buf, bsize, " %4.2f%s", n / (ksize * ksize), bytes ? "MB" : "M" );
}
else if(n >= ksize) {
else if(n >= 10 * ksize) {
snprintf(buf, bsize, " %4.1f%s", n / ksize, bytes ? "KB" : "K" );
}
else if(n >= ksize) {
snprintf(buf, bsize, " %4.2f%s", n / ksize, bytes ? "KB" : "K" );
}
else {
snprintf(buf, bsize, " %4.0f%s", n, bytes ? "B" : "b");
}
......@@ -220,6 +223,9 @@ void analyse_data() {
if(options.showports == OPTION_PORTS_SRC || options.showports == OPTION_PORTS_OFF) {
ap.dst_port = 0;
}
if(options.showports == OPTION_PORTS_OFF) {
ap.protocol = 0;
}
if(hash_find(screen_hash, &ap, (void**)&screen_line) == HASH_STATUS_KEY_NOT_FOUND) {
......
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