diff --git a/package/network/utils/iftop/Makefile b/package/network/utils/iftop/Makefile new file mode 100644 index 000000000..9feb05914 --- /dev/null +++ b/package/network/utils/iftop/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=iftop +PKG_VERSION:=0.17 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.ex-parrot.com/~pdw/iftop/download +PKG_MD5SUM:=062bc8fb3856580319857326e0b8752d + +PKG_MAINTAINER:=Jo-Philipp Wich + +include $(INCLUDE_DIR)/package.mk + +define Package/iftop + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libncurses +libpthread + TITLE:=display bandwith usage on an interface + URL:=http://www.ex-parrot.com/~pdw/iftop/ +endef + +define Package/iftop/description + iftop does for network usage what top(1) does for CPU usage. It + listens to network traffic on a named interface and displays a + table of current bandwidth usage by pairs of hosts. Handy for + answering the question 'why is our ADSL link so slow?'. +endef + +define Package/iftop/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/iftop $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,iftop)) diff --git a/package/network/utils/iftop/patches/001-debian_armeb.patch b/package/network/utils/iftop/patches/001-debian_armeb.patch new file mode 100644 index 000000000..8abd92e1b --- /dev/null +++ b/package/network/utils/iftop/patches/001-debian_armeb.patch @@ -0,0 +1,11 @@ +--- a/ether.h ++++ b/ether.h +@@ -12,7 +12,7 @@ struct ether_header { + u_int8_t ether_dhost[ETHER_ADDR_LEN]; + u_int8_t ether_shost[ETHER_ADDR_LEN]; + u_int16_t ether_type; +-}; ++} __attribute__((packed)); + + struct vlan_8021q_header { + u_int16_t priority_cfi_vid; diff --git a/package/network/utils/iftop/patches/002-debian_frozen_order.patch b/package/network/utils/iftop/patches/002-debian_frozen_order.patch new file mode 100644 index 000000000..c622036c5 --- /dev/null +++ b/package/network/utils/iftop/patches/002-debian_frozen_order.patch @@ -0,0 +1,10 @@ +--- a/ui.c ++++ b/ui.c +@@ -446,6 +446,7 @@ void screen_hash_clear() { + hash_node_type* n = NULL; + while(hash_next_item(screen_hash, &n) == HASH_STATUS_OK) { + host_pair_line* hpl = (host_pair_line*)n->rec; ++ hpl->total_recv = hpl->total_sent = 0; + memset(hpl->recv, 0, sizeof(hpl->recv)); + memset(hpl->sent, 0, sizeof(hpl->sent)); + } diff --git a/package/network/utils/iftop/patches/003-debian_arm.patch b/package/network/utils/iftop/patches/003-debian_arm.patch new file mode 100644 index 000000000..090ea1cbb --- /dev/null +++ b/package/network/utils/iftop/patches/003-debian_arm.patch @@ -0,0 +1,15 @@ +--- a/cfgfile.c ++++ b/cfgfile.c +@@ -45,9 +45,9 @@ stringmap config; + extern options_t options ; + + int is_cfgdirective_valid(const char *s) { +- char **t; +- for (t = config_directives; *t != NULL; ++t) +- if (strcmp(s, *t) == 0) return 1; ++ int t; ++ for (t = 0; config_directives[t] != NULL; t++) ++ if (strcmp(s, config_directives[t]) == 0) return 1; + return 0; + } + diff --git a/package/network/utils/iftop/patches/004-debian_bar_display.patch b/package/network/utils/iftop/patches/004-debian_bar_display.patch new file mode 100644 index 000000000..7efaa2bfa --- /dev/null +++ b/package/network/utils/iftop/patches/004-debian_bar_display.patch @@ -0,0 +1,11 @@ +--- a/options.c ++++ b/options.c +@@ -302,7 +302,7 @@ void options_read_args(int argc, char ** + break; + + case 'b': +- config_set_string("show-bars", "true"); ++ config_set_string("show-bars", "false"); + break; + + case 'B': diff --git a/package/network/utils/iftop/patches/005-debian_bar_bytes.patch b/package/network/utils/iftop/patches/005-debian_bar_bytes.patch new file mode 100644 index 000000000..b9ecc26f0 --- /dev/null +++ b/package/network/utils/iftop/patches/005-debian_bar_bytes.patch @@ -0,0 +1,11 @@ +--- a/ui.c ++++ b/ui.c +@@ -263,7 +263,7 @@ static void draw_bar_scale(int* y) { + char s[40], *p; + int x; + /* This 1024 vs 1000 stuff is just plain evil */ +- readable_size(i, s, sizeof s, options.log_scale ? 1000 : 1024, 0); ++ readable_size(i, s, sizeof s, options.log_scale ? 1000 : 1024, options.bandwidth_in_bytes); + p = s + strspn(s, " "); + x = get_bar_length(i * 8); + mvaddch(*y + 1, x, ACS_BTEE);