Added "S" and "D" to turn port display on/off.
This commit is contained in:
8
iftop.8
8
iftop.8
@@ -58,6 +58,9 @@ Don't do hostname lookups. This setting may be altered at run time.
|
||||
Run in promiscuous mode, so that traffic which does not pass directly through
|
||||
the specified interface is also counted.
|
||||
.TP
|
||||
\fB-P\fP
|
||||
Turn on port display.
|
||||
.TP
|
||||
\fB-b\fP
|
||||
Don't display bar graphs of traffic. This setting may be altered at run time.
|
||||
.TP
|
||||
@@ -129,6 +132,11 @@ for each source or destination will be aggregated together. This is most
|
||||
useful when \fBiftop\fP is run in promiscuous mode, or is run on a gateway
|
||||
machine.
|
||||
|
||||
.SH PORT DISPLAY
|
||||
|
||||
\fBS\fP or \fBD\fP toggle the display of source and destination ports
|
||||
respectively.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR tcpdump (8),
|
||||
.BR pcap (3),
|
||||
|
||||
@@ -18,8 +18,8 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
OPTION_PORTS_OFF,
|
||||
OPTION_PORTS_AGGSRC,
|
||||
OPTION_PORTS_AGGDEST,
|
||||
OPTION_PORTS_SRC,
|
||||
OPTION_PORTS_DEST,
|
||||
OPTION_PORTS_ON
|
||||
} option_port_t;
|
||||
|
||||
|
||||
58
ui.c
58
ui.c
@@ -212,10 +212,10 @@ void analyse_data() {
|
||||
}
|
||||
|
||||
/* Aggregate ports, if required */
|
||||
if(options.showports == OPTION_PORTS_AGGSRC || options.showports == OPTION_PORTS_OFF) {
|
||||
if(options.showports == OPTION_PORTS_DEST || options.showports == OPTION_PORTS_OFF) {
|
||||
ap.src_port = 0;
|
||||
}
|
||||
if(options.showports == OPTION_PORTS_AGGDEST || options.showports == OPTION_PORTS_OFF) {
|
||||
if(options.showports == OPTION_PORTS_SRC || options.showports == OPTION_PORTS_OFF) {
|
||||
ap.dst_port = 0;
|
||||
}
|
||||
|
||||
@@ -333,28 +333,28 @@ void ui_print() {
|
||||
//erase();
|
||||
move(0, 0);
|
||||
attron(A_REVERSE);
|
||||
addstr(" Q ");
|
||||
addstr(" q ");
|
||||
attroff(A_REVERSE);
|
||||
addstr(" quit ");
|
||||
attron(A_REVERSE);
|
||||
addstr(" R ");
|
||||
addstr(" r ");
|
||||
attroff(A_REVERSE);
|
||||
addstr(options.dnsresolution ? " resolver off "
|
||||
: " resolver on ");
|
||||
attron(A_REVERSE);
|
||||
addstr(" B ");
|
||||
addstr(" b ");
|
||||
attroff(A_REVERSE);
|
||||
addstr(options.showbars ? " bars off "
|
||||
: " bars on ");
|
||||
|
||||
attron(A_REVERSE);
|
||||
addstr(" S ");
|
||||
addstr(" s ");
|
||||
attroff(A_REVERSE);
|
||||
addstr(options.aggregate == OPTION_AGGREGATE_SRC ? " aggregate off "
|
||||
: " aggregate src ");
|
||||
|
||||
attron(A_REVERSE);
|
||||
addstr(" D ");
|
||||
addstr(" d ");
|
||||
attroff(A_REVERSE);
|
||||
addstr(options.aggregate == OPTION_AGGREGATE_DEST ? " aggregate off "
|
||||
: " aggregate dest ");
|
||||
@@ -466,36 +466,66 @@ void ui_loop() {
|
||||
extern sig_atomic_t foad;
|
||||
while(foad == 0) {
|
||||
int i;
|
||||
i = toupper(getch());
|
||||
i = getch();
|
||||
switch (i) {
|
||||
case 'Q':
|
||||
case 'q':
|
||||
foad = 1;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
case 'r':
|
||||
options.dnsresolution = !options.dnsresolution;
|
||||
tick(1);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
case 'b':
|
||||
options.showbars = !options.showbars;
|
||||
tick(1);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
case 's':
|
||||
options.aggregate =
|
||||
(options.aggregate == OPTION_AGGREGATE_SRC)
|
||||
? OPTION_AGGREGATE_OFF
|
||||
: OPTION_AGGREGATE_SRC;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
case 'd':
|
||||
options.aggregate =
|
||||
(options.aggregate == OPTION_AGGREGATE_DEST)
|
||||
? OPTION_AGGREGATE_OFF
|
||||
: OPTION_AGGREGATE_DEST;
|
||||
break;
|
||||
case 'P':
|
||||
case 'S':
|
||||
/* Show source ports */
|
||||
if(options.showports == OPTION_PORTS_OFF) {
|
||||
options.showports = OPTION_PORTS_SRC;
|
||||
}
|
||||
else if(options.showports == OPTION_PORTS_DEST) {
|
||||
options.showports = OPTION_PORTS_ON;
|
||||
}
|
||||
else if(options.showports == OPTION_PORTS_ON) {
|
||||
options.showports = OPTION_PORTS_DEST;
|
||||
}
|
||||
else {
|
||||
options.showports = OPTION_PORTS_OFF;
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
/* Show dest ports */
|
||||
if(options.showports == OPTION_PORTS_OFF) {
|
||||
options.showports = OPTION_PORTS_DEST;
|
||||
}
|
||||
else if(options.showports == OPTION_PORTS_SRC) {
|
||||
options.showports = OPTION_PORTS_ON;
|
||||
}
|
||||
else if(options.showports == OPTION_PORTS_ON) {
|
||||
options.showports = OPTION_PORTS_SRC;
|
||||
}
|
||||
else {
|
||||
options.showports = OPTION_PORTS_OFF;
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
options.showports =
|
||||
(options.showports == OPTION_PORTS_OFF)
|
||||
? OPTION_PORTS_ON
|
||||
|
||||
Reference in New Issue
Block a user