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