summaryrefslogtreecommitdiff
path: root/iftop.c
diff options
context:
space:
mode:
authorchris <>2003-02-06 10:51:24 +0000
committerchris <>2003-02-06 10:51:24 +0000
commit2dc4a06dda004862b5718a6d5ad0c0373558dc1a (patch)
tree5d94b350445ac019c9ff6e6be5bf49b2f807c30b /iftop.c
parent5058cf3bc5934ef4080b5ef422f4a24b49db4a42 (diff)
downloadiftop-2dc4a06dda004862b5718a6d5ad0c0373558dc1a.zip
""
Diffstat (limited to 'iftop.c')
-rw-r--r--iftop.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/iftop.c b/iftop.c
index 6c4129a..522d308 100644
--- a/iftop.c
+++ b/iftop.c
@@ -417,7 +417,7 @@ void packet_init() {
}
strncpy(ifr.ifr_name, options.interface, IFNAMSIZ);
ifr.ifr_hwaddr.sa_family = AF_UNSPEC;
- if (ioctl(s, SIOCGIFHWADDR, &ifr) == -1) {
+ if (ioctl(s, SIOCGIFADDR, &ifr) == -1) {
fprintf(stderr, "Error getting hardware address for interface: %s\n", options.interface);
perror("ioctl(SIOCGIFHWADDR)");
exit(1);
@@ -428,6 +428,8 @@ void packet_init() {
for (s = 0; s < 6; ++s)
fprintf(stderr, "%c%02x", s ? ':' : ' ', (unsigned int)if_hw_addr[s]);
fprintf(stderr, "\n");
+
+ fprintf(stderr, "IP address is: %s", inet_ntoa(((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr));
resolver_initialise();