From f7eaee348214b0d8b069cd448f0108a6f70e705a Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 3 Aug 2006 09:01:32 +0000 Subject: [PATCH] Port iptraf to -ng SVN-Revision: 4412 --- net/iptraf/Makefile | 58 +++++ net/iptraf/patches/01-cross_compile.patch | 24 ++ net/iptraf/patches/02-ifaces.patch | 294 ++++++++++++++++++++++ 3 files changed, 376 insertions(+) create mode 100644 net/iptraf/Makefile create mode 100644 net/iptraf/patches/01-cross_compile.patch create mode 100644 net/iptraf/patches/02-ifaces.patch diff --git a/net/iptraf/Makefile b/net/iptraf/Makefile new file mode 100644 index 0000000000..02c31ee18c --- /dev/null +++ b/net/iptraf/Makefile @@ -0,0 +1,58 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=iptraf +PKG_VERSION:=3.0.0 +PKG_RELEASE:=1 +PKG_MD5SUM:=377371c28ee3c21a76f7024920649ea8 + +PKG_SOURCE_URL:=ftp://iptraf.seul.org/pub/iptraf/ \ + ftp://the.wiretapped.net/pub/security/network-monitoring/iptraf/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/iptraf + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libncurses + TITLE:=A console-based network monitoring program + DESCRIPTION:=IPTraf is a console-based network statistics utility for Linux. It gathers\\\ +a variety of figures such as TCP connection packet and byte counts,\\\ +interface statistics and activity indicators, TCP/UDP traffic breakdowns,\\\ +and LAN station packet and byte counts.\\\ + URL:=http://iptraf.seul.org/ +endef + + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/src \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + DEBUG="" \ + INCLUDEDIR="-I../support -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \ + LDOPTS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + PLATFORM="-DPLATFORM=\\\"Linux/$(ARCH)\\\"" \ + TARGET="/usr/bin" \ + WORKDIR="/var/lib/iptraf" \ + all +endef + +define Package/iptraf/install + install -d -m0755 $(1)/usr/bin \ + $(1)/var/run/iptraf \ + $(1)/var/lib/iptraf + install -m0755 $(PKG_BUILD_DIR)/src/iptraf $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,iptraf)) diff --git a/net/iptraf/patches/01-cross_compile.patch b/net/iptraf/patches/01-cross_compile.patch new file mode 100644 index 0000000000..c12719d25a --- /dev/null +++ b/net/iptraf/patches/01-cross_compile.patch @@ -0,0 +1,24 @@ +diff -urN iptraf-3.0.0/support/Makefile iptraf-3.0.0.new/support/Makefile +--- iptraf-3.0.0/support/Makefile 2002-07-19 18:31:48.000000000 +0200 ++++ iptraf-3.0.0.new/support/Makefile 2006-04-16 16:07:58.000000000 +0200 +@@ -3,16 +3,14 @@ + OBJS = input.o menurt.o listbox.o winops.o labels.o \ + msgboxes.o txbox.o + +-all: libtextbox.a +- + libtextbox.a: $(OBJS) + rm -rf libtextbox.a +- ar cq libtextbox.a $(OBJS) +- ranlib libtextbox.a +-# gcc -shared -o libtextbox.so $(OBJS) ++ $(AR) cq libtextbox.a $(OBJS) ++ $(RANLIB) libtextbox.a ++# $(CC) -shared -o libtextbox.so $(OBJS) + + %.o: %.c *.h +- gcc -O2 -g -Wall -fPIC $(INCLUDEDIR) -c -o $*.o $< ++ $(CC) -O2 -g -Wall -fPIC $(INCLUDEDIR) -c -o $*.o $< + + clean: + rm -rf *.o *~ libtextbox.a libtextbox.so diff --git a/net/iptraf/patches/02-ifaces.patch b/net/iptraf/patches/02-ifaces.patch new file mode 100644 index 0000000000..0b70022f09 --- /dev/null +++ b/net/iptraf/patches/02-ifaces.patch @@ -0,0 +1,294 @@ +diff -urN iptraf-3.0.0/src/dirs.h iptraf-3.0.0.new/src/dirs.h +--- iptraf-3.0.0/src/dirs.h 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/dirs.h 2006-04-16 16:08:27.000000000 +0200 +@@ -155,7 +155,6 @@ + */ + + #define ETHFILE get_path(T_WORKDIR, "ethernet.desc") +-#define FDDIFILE get_path(T_WORKDIR, "fddi.desc") + + /* + * The rvnamed program file +diff -urN iptraf-3.0.0/src/hostmon.c iptraf-3.0.0.new/src/hostmon.c +--- iptraf-3.0.0/src/hostmon.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/hostmon.c 2006-04-16 16:29:27.000000000 +0200 +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -293,8 +292,6 @@ + wprintw(table->tabwin, "Ethernet"); + else if (entry->un.desc.linktype == LINK_PLIP) + wprintw(table->tabwin, "PLIP"); +- else if (entry->un.desc.linktype == LINK_FDDI) +- wprintw(table->tabwin, "FDDI"); + + wprintw(table->tabwin, " HW addr: %s", entry->un.desc.ascaddr); + +@@ -722,7 +719,7 @@ + unsigned long long updtime_usec = 0; + + struct desclist elist; /* Ethernet description list */ +- struct desclist flist; /* FDDI description list */ ++ struct desclist flist; /* Other links description list */ + struct desclist *list = NULL; + + FILE *logfile = NULL; +@@ -786,7 +783,6 @@ + + initethtab(&table, options->actmode); + loaddesclist(&elist, LINK_ETHERNET, WITHETCETHERS); +- loaddesclist(&flist, LINK_FDDI, WITHETCETHERS); + + if (logging) { + if (strcmp(current_logfile, "") == 0) { +@@ -900,9 +896,7 @@ + if (pkt_result != PACKET_OK) + continue; + +- if ((linktype == LINK_ETHERNET) || (linktype == LINK_FDDI) +- || (linktype == LINK_PLIP) || (linktype == LINK_TR) || +- (linktype == LINK_VLAN)) { ++ if ((linktype == LINK_ETHERNET) || (linktype == LINK_PLIP) || (linktype == LINK_TR) || (linktype == LINK_VLAN)) { + + if (fromaddr.sll_protocol == htons(ETH_P_IP)) + is_ip = 1; +@@ -920,12 +914,6 @@ + memcpy(scratch_daddr, ((struct ethhdr *) buf)->h_dest, + ETH_ALEN); + list = &elist; +- } else if (linktype == LINK_FDDI) { +- memcpy(scratch_saddr, ((struct fddihdr *) buf)->saddr, +- FDDI_K_ALEN); +- memcpy(scratch_daddr, ((struct fddihdr *) buf)->daddr, +- FDDI_K_ALEN); +- list = &flist; + } else if (linktype == LINK_TR) { + memcpy(scratch_saddr, ((struct trh_hdr *) buf)->saddr, + TR_ALEN); +diff -urN iptraf-3.0.0/src/ifaces.c iptraf-3.0.0.new/src/ifaces.c +--- iptraf-3.0.0/src/ifaces.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/ifaces.c 2006-04-16 16:10:10.000000000 +0200 +@@ -37,7 +37,7 @@ + extern int daemonized; + + char ifaces[][6] = +- { "lo", "eth", "sl", "ppp", "ippp", "plip", "fddi", "isdn", "dvb", ++ { "lo", "eth", "sl", "ppp", "ippp", "plip", "isdn", "dvb", + "pvc", "hdlc", "ipsec", "sbni", "tr", "wvlan", "wlan", "sm2", "sm3", + "pent", "lec", "brg", "tun", "tap", "cipcb", "tunl", "vlan" + }; +diff -urN iptraf-3.0.0/src/landesc.c iptraf-3.0.0.new/src/landesc.c +--- iptraf-3.0.0/src/landesc.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/landesc.c 2006-04-16 16:10:29.000000000 +0200 +@@ -83,8 +83,6 @@ + + if (linktype == LINK_ETHERNET) + fd = fopen(ETHFILE, "r"); +- else if (linktype == LINK_FDDI) +- fd = fopen(FDDIFILE, "r"); + + if (fd == NULL) { + return; +@@ -205,8 +203,6 @@ + + if (linktype == LINK_ETHERNET) + fd = fopen(ETHFILE, "w"); +- else if (linktype == LINK_FDDI) +- fd = fopen(FDDIFILE, "w"); + + if (fd < 0) { + etherr(); +diff -urN iptraf-3.0.0/src/links.h iptraf-3.0.0.new/src/links.h +--- iptraf-3.0.0/src/links.h 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/links.h 2006-04-16 16:10:39.000000000 +0200 +@@ -6,7 +6,6 @@ + #define LINK_ISDN_RAWIP 6 + #define LINK_ISDN_CISCOHDLC 7 + #define LINK_CISCOHDLC 7 +-#define LINK_FDDI 8 + #define LINK_FRAD 9 + #define LINK_DLCI 10 + #define LINK_TR 11 +diff -urN iptraf-3.0.0/src/log.c iptraf-3.0.0.new/src/log.c +--- iptraf-3.0.0/src/log.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/log.c 2006-04-16 16:10:53.000000000 +0200 +@@ -491,8 +491,6 @@ + ptmp->un.desc.ascaddr); + else if (ptmp->un.desc.linktype == LINK_PLIP) + fprintf(fd, "\nPLIP address: %s", ptmp->un.desc.ascaddr); +- else if (ptmp->un.desc.linktype == LINK_FDDI) +- fprintf(fd, "\nFDDI address: %s", ptmp->un.desc.ascaddr); + + if (ptmp->un.desc.withdesc) + fprintf(fd, " (%s)", ptmp->un.desc.desc); +diff -urN iptraf-3.0.0/src/options.c iptraf-3.0.0.new/src/options.c +--- iptraf-3.0.0/src/options.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/options.c 2006-04-16 16:23:52.000000000 +0200 +@@ -68,8 +68,6 @@ + tx_additem(menu, NULL, NULL); + tx_additem(menu, " ^E^thernet/PLIP host descriptions...", + "Manages descriptions for Ethernet and PLIP addresses"); +- tx_additem(menu, " ^F^DDI/Token Ring host descriptions...", +- "Manages descriptions for FDDI and FDDI addresses"); + tx_additem(menu, NULL, NULL); + tx_additem(menu, " E^x^it configuration", "Returns to main menu"); + } +@@ -371,9 +369,6 @@ + case 14: + ethdescmgr(LINK_ETHERNET); + break; +- case 15: +- ethdescmgr(LINK_FDDI); +- break; + } + + indicatesetting(row, options, statwin); +diff -urN iptraf-3.0.0/src/othptab.c iptraf-3.0.0.new/src/othptab.c +--- iptraf-3.0.0/src/othptab.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/othptab.c 2006-04-16 16:24:21.000000000 +0200 +@@ -19,7 +19,6 @@ + #include + #include + #include +-#include + #include + #include "arphdr.h" + #include "options.h" +@@ -139,11 +138,6 @@ + new_entry->smacaddr); + convmacaddr(((struct ethhdr *) packet)->h_dest, + new_entry->dmacaddr); +- } else if (linkproto == LINK_FDDI) { +- convmacaddr(((struct fddihdr *) packet)->saddr, +- new_entry->smacaddr); +- convmacaddr(((struct fddihdr *) packet)->daddr, +- new_entry->dmacaddr); + } else if (linkproto == LINK_TR) { + convmacaddr(((struct trh_hdr *) packet)->saddr, + new_entry->smacaddr); +@@ -373,8 +367,7 @@ + strcat(msgstring, scratchpad); + + if ((entry->linkproto == LINK_ETHERNET) || +- (entry->linkproto == LINK_PLIP) || +- (entry->linkproto == LINK_FDDI)) { ++ (entry->linkproto == LINK_PLIP)) { + sprintf(scratchpad, " from %s to %s on %s", + entry->smacaddr, entry->dmacaddr, entry->iface); + +diff -urN iptraf-3.0.0/src/packet.c iptraf-3.0.0.new/src/packet.c +--- iptraf-3.0.0/src/packet.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/packet.c 2006-04-16 16:11:55.000000000 +0200 +@@ -35,7 +35,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -81,8 +80,6 @@ + result = LINK_ETHERNET; + else if (strncmp(ifname, "plip", 4) == 0) + result = LINK_PLIP; +- else if (strncmp(ifname, "fddi", 4) == 0) /* For some Ethernet- */ +- result = LINK_ETHERNET; /* emulated FDDI ifaces */ + else if (strncmp(ifname, "dvb", 3) == 0) + result = LINK_ETHERNET; + else if (strncmp(ifname, "sbni", 4) == 0) +@@ -136,9 +133,6 @@ + case ARPHRD_PPP: + result = LINK_PPP; + break; +- case ARPHRD_FDDI: +- result = LINK_FDDI; +- break; + case ARPHRD_IEEE802: + case ARPHRD_IEEE802_TR: + result = LINK_TR; +@@ -194,19 +188,6 @@ + *packet = tpacket + 4; + *readlen -= 4; + break; +- case LINK_FDDI: +- *packet = tpacket + sizeof(struct fddihdr); +- *readlen -= sizeof(struct fddihdr); +- +- /* +- * Move IP data into an aligned buffer. 96 bytes should be sufficient +- * for IP and TCP headers with reasonable numbers of options and some +- * data. +- */ +- +- memmove(aligned_buf, *packet, min(SNAPSHOT_LEN, *readlen)); +- *packet = aligned_buf; +- break; + case LINK_TR: + /* + * Token Ring patch supplied by Tomas Dvorak +diff -urN iptraf-3.0.0/src/promisc.c iptraf-3.0.0.new/src/promisc.c +--- iptraf-3.0.0/src/promisc.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/promisc.c 2006-04-16 16:12:56.000000000 +0200 +@@ -81,8 +81,8 @@ + */ + + if ((strncmp(buf, "eth", 3) == 0) || +- (strncmp(buf, "fddi", 4) == 0) || + (strncmp(buf, "tr", 2) == 0) || ++ (strncmp(buf, "vlan", 4) == 0) || + (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) || + (strncmp(ptmp->params.ifname, "lec", 3) == 0) || + (accept_unsupported_interfaces)) { +@@ -195,7 +195,7 @@ + + while (ptmp != NULL) { + if (((strncmp(ptmp->params.ifname, "eth", 3) == 0) || +- (strncmp(ptmp->params.ifname, "fddi", 4) == 0) || ++ (strncmp(ptmp->params.ifname, "vlan", 4) == 0) || + (strncmp(ptmp->params.ifname, "tr", 2) == 0) || + (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) || + (strncmp(ptmp->params.ifname, "lec", 3) == 0)) && +diff -urN iptraf-3.0.0/src/rvnamed.h iptraf-3.0.0.new/src/rvnamed.h +--- iptraf-3.0.0/src/rvnamed.h 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/rvnamed.h 2006-04-16 16:13:39.000000000 +0200 +@@ -1,9 +1,9 @@ + #include + #include + +-#define CHILDSOCKNAME "/dev/rvndcldcomsk" +-#define PARENTSOCKNAME "/dev/rvndpntcomsk" +-#define IPTSOCKNAME "/dev/rvndiptcomsk" ++#define CHILDSOCKNAME "/tmp/rvndcldcomsk" ++#define PARENTSOCKNAME "/tmp/rvndpntcomsk" ++#define IPTSOCKNAME "/tmp/rvndiptcomsk" + + #define SOCKET_PREFIX "isock" + +diff -urN iptraf-3.0.0/src/tcptable.c iptraf-3.0.0.new/src/tcptable.c +--- iptraf-3.0.0/src/tcptable.c 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/tcptable.c 2006-04-16 16:13:54.000000000 +0200 +@@ -600,8 +600,6 @@ + + if ((linkproto == LINK_ETHERNET) || (linkproto == LINK_PLIP)) { + convmacaddr(((struct ethhdr *) packet)->h_source, newmacaddr); +- } else if (linkproto == LINK_FDDI) { +- convmacaddr(((struct fddihdr *) packet)->saddr, newmacaddr); + } else if (linkproto == LINK_TR) { + convmacaddr(((struct trh_hdr *) packet)->saddr, newmacaddr); + } +diff -urN iptraf-3.0.0/src/tcptable.h iptraf-3.0.0.new/src/tcptable.h +--- iptraf-3.0.0/src/tcptable.h 2005-09-13 08:42:54.000000000 +0200 ++++ iptraf-3.0.0.new/src/tcptable.h 2006-04-16 16:14:03.000000000 +0200 +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + #include + #include + #include -- 2.30.2