diff --git a/iftop.c b/iftop.c index 10a71ed..4e6093d 100644 --- a/iftop.c +++ b/iftop.c @@ -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 { diff --git a/ui.c b/ui.c index 40e8e39..d57682d 100644 --- a/ui.c +++ b/ui.c @@ -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) {