Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Paul Warren
iftop
Commits
45ccb4e4
Commit
45ccb4e4
authored
Oct 18, 2002
by
pdw
Browse files
Various changes for portability to FreeBSD.
Added "R" to control service resolution.
parent
94b6ab8f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
45ccb4e4
...
...
@@ -29,7 +29,7 @@ MANDIR = man
#MANDIR = share/man # FHS-ish
# You shouldn't need to change anything below this point.
VERSION
=
0.
8
VERSION
=
0.
9pre1
CFLAGS
+=
-g
-Wall
"-DIFTOP_VERSION=
\"
$(VERSION)
\"
"
LDFLAGS
+=
-g
LDLIBS
+=
-lpcap
-lpthread
-lcurses
-lm
...
...
addr_hash.h
View file @
45ccb4e4
...
...
@@ -6,6 +6,7 @@
#ifndef __ADDR_HASH_H_
/* include guard */
#define __ADDR_HASH_H_
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
...
...
iftop.c
View file @
45ccb4e4
...
...
@@ -7,6 +7,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/ethernet.h>
...
...
@@ -130,7 +132,7 @@ void assign_addr_pair(addr_pair* ap, struct ip* iptr, int flip) {
unsigned
short
int
dst_port
=
0
;
/* Does this protocol use ports? */
if
(
iptr
->
ip_p
==
SOL
_TCP
||
iptr
->
ip_p
==
SOL
_UDP
)
{
if
(
iptr
->
ip_p
==
IPPROTO
_TCP
||
iptr
->
ip_p
==
IPPROTO
_UDP
)
{
/* We take a slight liberty here by treating UDP the same as TCP */
/* Find the TCP/UDP header */
...
...
iftop.h
View file @
45ccb4e4
...
...
@@ -33,4 +33,12 @@ void ui_init(void);
/* options.c */
void
options_read
(
int
argc
,
char
**
argv
);
/* Make use of SIOCGIFHWADDR work on FreeBSD */
#ifdef __BSD__
#define SIOCGIFHWADDR SIOCGIFADDR
#define ifr_hwaddr ifr_addr
#endif
#endif
/* __IFTOP_H_ */
options.c
View file @
45ccb4e4
...
...
@@ -64,6 +64,7 @@ static void set_defaults() {
inet_aton
(
"10.0.1.0"
,
&
options
.
netfilternet
);
inet_aton
(
"255.255.255.0"
,
&
options
.
netfiltermask
);
options
.
dnsresolution
=
1
;
options
.
portresolution
=
1
;
options
.
promiscuous
=
0
;
options
.
showbars
=
1
;
options
.
showports
=
OPTION_PORTS_OFF
;
...
...
options.h
View file @
45ccb4e4
...
...
@@ -35,6 +35,7 @@ typedef struct {
struct
in_addr
netfilternet
;
struct
in_addr
netfiltermask
;
int
dnsresolution
;
int
portresolution
;
int
promiscuous
;
int
showbars
;
option_port_t
showports
;
...
...
ui.c
View file @
45ccb4e4
...
...
@@ -328,7 +328,7 @@ void sprint_host(char * line, struct in_addr* addr, unsigned int port, unsigned
if(port != 0) {
skey.port = port;
skey.protocol = protocol;
if
(
hash_find
(
service_hash
,
&
skey
,
(
void
**
)
&
s_name
)
==
HASH_STATUS_OK
)
{
if(
options.portresolution &&
hash_find(service_hash, &skey, (void**)&s_name) == HASH_STATUS_OK) {
snprintf(service, HOSTNAME_LENGTH, ":%s", s_name);
}
else {
...
...
@@ -513,6 +513,11 @@ void ui_loop() {
tick(1);
break;
case 'R':
options.portresolution = !options.portresolution;
tick(1);
break;
case 'b':
options.showbars = !options.showbars;
tick(1);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment