""
This commit is contained in:
13
iftop.8
13
iftop.8
@@ -11,14 +11,15 @@ iftop - display bandwidth usage on an interface by host
|
|||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBiftop\fP \fB-h\fP |
|
\fBiftop\fP \fB-h\fP |
|
||||||
[\fB-dpb\fP] [\fB-i\fP \fIinterface\fP] [\fB-f\fP \fIfilter code\fP] [\fB-n\fP \fInet\fP/\fImask\fP]
|
[\fB-dpbP\fP] [\fB-i\fP \fIinterface\fP] [\fB-f\fP \fIfilter code\fP] [\fB-n\fP \fInet\fP/\fImask\fP]
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBiftop\fP listens to network traffic on a named \fIinterface\fP, or \fBeth0\fP
|
\fBiftop\fP listens to network traffic on a named \fIinterface\fP, or on the
|
||||||
if none is specified, and displays a table of current bandwidth usage by pairs
|
first interface it can find which looks like an external interface if none is
|
||||||
of hosts. \fBiftop\fP must be run with sufficient permissions to monitor all
|
specified, and displays a table of current bandwidth usage by pairs of hosts.
|
||||||
network traffic on the \fIinterface\fP; see \fBpcap\fP(3) for more information,
|
\fBiftop\fP must be run with sufficient permissions to monitor all network
|
||||||
but on most systems this means that it must be run as root.
|
traffic on the \fIinterface\fP; see \fBpcap\fP(3) for more information, but on
|
||||||
|
most systems this means that it must be run as root.
|
||||||
|
|
||||||
By default, \fBiftop\fP will look up the hostnames associated with addresses it
|
By default, \fBiftop\fP will look up the hostnames associated with addresses it
|
||||||
finds in packets. This can cause substantial traffic of itself, and may result
|
finds in packets. This can cause substantial traffic of itself, and may result
|
||||||
|
|||||||
4
iftop.c
4
iftop.c
@@ -23,7 +23,9 @@
|
|||||||
#include "resolver.h"
|
#include "resolver.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#ifdef DLT_LINUX_SLL
|
||||||
#include "sll.h"
|
#include "sll.h"
|
||||||
|
#endif /* DLT_LINUX_SLL */
|
||||||
#include "threadprof.h"
|
#include "threadprof.h"
|
||||||
#include "ether.h"
|
#include "ether.h"
|
||||||
#include "ip.h"
|
#include "ip.h"
|
||||||
@@ -253,6 +255,7 @@ static void handle_raw_packet(unsigned char* args, const struct pcap_pkthdr* pkt
|
|||||||
handle_ip_packet((struct ip*)packet, -1);
|
handle_ip_packet((struct ip*)packet, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DLT_LINUX_SLL
|
||||||
static void handle_cooked_packet(unsigned char *args, const struct pcap_pkthdr * thdr, const unsigned char * packet)
|
static void handle_cooked_packet(unsigned char *args, const struct pcap_pkthdr * thdr, const unsigned char * packet)
|
||||||
{
|
{
|
||||||
struct sll_header *sptr;
|
struct sll_header *sptr;
|
||||||
@@ -272,6 +275,7 @@ static void handle_cooked_packet(unsigned char *args, const struct pcap_pkthdr *
|
|||||||
}
|
}
|
||||||
handle_ip_packet((struct ip*)(packet+SLL_HDR_LEN), dir);
|
handle_ip_packet((struct ip*)(packet+SLL_HDR_LEN), dir);
|
||||||
}
|
}
|
||||||
|
#endif /* DLT_LINUX_SLL */
|
||||||
|
|
||||||
static void handle_eth_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet)
|
static void handle_eth_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ static char *get_first_interface(void) {
|
|||||||
} while (size * sizeof *ifc.ifc_req <= ifc.ifc_len);
|
} while (size * sizeof *ifc.ifc_req <= ifc.ifc_len);
|
||||||
/* Ugly. */
|
/* Ugly. */
|
||||||
for (ifr = ifc.ifc_req; (char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len; ++ifr) {
|
for (ifr = ifc.ifc_req; (char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len; ++ifr) {
|
||||||
if (strcmp(ifr->ifr_name, "lo") != 0 && strncmp(ifr->ifr_name, "dummy", 5) != 0
|
if (strcmp(ifr->ifr_name, "lo") != 0
|
||||||
|
&& strncmp(ifr->ifr_name, "dummy", 5) != 0
|
||||||
|
&& strncmp(ifr->ifr_name, "vmnet", 5) != 0
|
||||||
&& ioctl(s, SIOCGIFFLAGS, ifr) == 0 && ifr->ifr_flags & IFF_UP) {
|
&& ioctl(s, SIOCGIFFLAGS, ifr) == 0 && ifr->ifr_flags & IFF_UP) {
|
||||||
i = xstrdup(ifr->ifr_name);
|
i = xstrdup(ifr->ifr_name);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user