diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2015-07-13 23:03:08 +0300 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-07-17 12:03:44 +0200 |
commit | 246868dd98b913ff6c989216a49d395305c13da6 (patch) | |
tree | dfcefbbf96f777caa42b344dbe2a5b1c58a8c715 /flowtop.c | |
parent | 6d2aa3dae7c2dc95f882786f5629dde05b91e5dc (diff) |
flowtop: Show total numbers of flows
Count flows which might be showed and show this number
on the top status line.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'flowtop.c')
-rw-r--r-- | flowtop.c | 33 |
1 files changed, 19 insertions, 14 deletions
@@ -951,6 +951,8 @@ static void presenter_screen_update(WINDOW *screen, struct flow_list *fl, int skip_lines) { int maxy; + int skip_left = skip_lines; + unsigned int flows = 0; unsigned int line = 3; struct flow_entry *n; @@ -968,15 +970,6 @@ static void presenter_screen_update(WINDOW *screen, struct flow_list *fl, wclear(screen); clear(); - mvwprintw(screen, 1, 2, "Kernel netfilter flows for %s%s%s%s%s%s" - "[+%d]", what & INCLUDE_TCP ? "TCP, " : "" , - what & INCLUDE_UDP ? "UDP, " : "", - what & INCLUDE_SCTP ? "SCTP, " : "", - what & INCLUDE_DCCP ? "DCCP, " : "", - what & INCLUDE_ICMP && what & INCLUDE_IPV4 ? "ICMP, " : "", - what & INCLUDE_ICMP && what & INCLUDE_IPV6 ? "ICMP6, " : "", - skip_lines); - rcu_read_lock(); n = rcu_dereference(fl->head); @@ -985,17 +978,20 @@ static void presenter_screen_update(WINDOW *screen, struct flow_list *fl, "Is netfilter running?)"); for (; n; n = rcu_dereference(n->next)) { - if (maxy <= 0) - goto skip; - if (presenter_get_port(n->port_src, n->port_dst, 0) == 53) goto skip; if (presenter_flow_wrong_state(n)) goto skip; - if (skip_lines > 0) { - skip_lines--; + /* count only flows which might be showed */ + flows++; + + if (maxy <= 0) + goto skip; + + if (skip_left > 0) { + skip_left--; goto skip; } @@ -1010,6 +1006,15 @@ skip: continue; } + mvwprintw(screen, 1, 2, "Kernel netfilter flows(%u) for %s%s%s%s%s%s" + "[+%d]", flows, what & INCLUDE_TCP ? "TCP, " : "" , + what & INCLUDE_UDP ? "UDP, " : "", + what & INCLUDE_SCTP ? "SCTP, " : "", + what & INCLUDE_DCCP ? "DCCP, " : "", + what & INCLUDE_ICMP && what & INCLUDE_IPV4 ? "ICMP, " : "", + what & INCLUDE_ICMP && what & INCLUDE_IPV6 ? "ICMP6, " : "", + skip_lines); + rcu_read_unlock(); wrefresh(screen); |