main/iptraf-ng: replace iptraf

This commit is contained in:
Natanael Copa 2012-08-17 11:56:26 +00:00
parent d4cb432f2a
commit 61d4acf829
4 changed files with 34 additions and 140 deletions

34
main/iptraf-ng/APKBUILD Normal file
View File

@ -0,0 +1,34 @@
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=iptraf-ng
pkgver=1.1.3.1
pkgrel=0
pkgdesc="IP Network Monitoring Software (fork of original iptraf)"
url="https://fedorahosted.org/iptraf-ng/"
arch="all"
license="GPLv2"
depends=
makedepends="ncurses-dev"
install=
subpackages="$pkgname-doc"
source="https://fedorahosted.org/releases/i/p/$pkgname/$pkgname-$pkgver.tar.gz"
_builddir="$srcdir"/iptraf-ng-$pkgver
prepare() {
cd "$_builddir"
}
build() {
cd "$_builddir"
CFLAGS="$CFLAGS -std=gnu99" ./configure --prefix=/usr \
|| return 1
make
}
package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install
}
md5sums="1a2c02944b0b012d6a3de96207610fa2 iptraf-ng-1.1.3.1.tar.gz"

View File

@ -1,44 +0,0 @@
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=iptraf
pkgver=3.0.0
pkgrel=4
pkgdesc="IP Network Monitoring Software"
url="http://iptraf.seoul.org"
arch="all"
license="GPL"
depends=
makedepends="ncurses-dev"
install=
subpackages="$pkgname-doc"
source="ftp://iptraf.seul.org/pub/$pkgname/$pkgname-$pkgver.tar.gz
iptraf-3.0.0-vlan.patch
iptraf-3.0.0-interface.patch
"
build() {
cd "$srcdir/$pkgname-$pkgver/src"
patch -p1 -i "$srcdir"/iptraf-3.0.0-vlan.patch || return 1
sed -i -e s:/var/local/iptraf:/var/lib/iptraf: \
-e s:/usr/local/bin:/usr/sbin: dirs.h
make CFLAGS="$CFLAGS" DEBUG="" TARGET="/usr/sbin" \
WORKDIR="/var/lib/iptraf" || return 1
for sbin in iptraf rvnamed; do
install -D -m755 $sbin "$pkgdir"/usr/sbin/$sbin
done
cd ../Documentation
for man in *.8; do
install -D -m644 $man "$pkgdir"/usr/share/man/man8/$man
done
for dir in lib log run; do
mkdir -p "$pkgdir"/var/$dir/iptraf
done
}
md5sums="377371c28ee3c21a76f7024920649ea8 iptraf-3.0.0.tar.gz
4136483b9e41c8789c629c42f9a67d07 iptraf-3.0.0-vlan.patch
667def7e433fe95823fec8faeb3cd8b9 iptraf-3.0.0-interface.patch"

View File

@ -1,68 +0,0 @@
--- iptraf-3.0.0/src/packet.c.interface 2005-09-13 08:42:54.000000000 +0200
+++ iptraf-3.0.0/src/packet.c 2008-04-22 15:27:30.000000000 +0200
@@ -102,11 +102,19 @@ unsigned short getlinktype(unsigned shor
else if (strncmp(ifname, "tun", 3) == 0)
result = LINK_ETHERNET;
else if (strncmp(ifname, "vlan", 3) == 0)
- result = LINK_VLAN;
+ result = LINK_ETHERNET;
+ else if (strncmp(ifname, "bond", 4) == 0)
+ result = LINK_ETHERNET;
else if (strncmp(ifname, "brg", 3) == 0)
result = LINK_ETHERNET;
else if (strncmp(ifname, "tap", 3) == 0)
result = LINK_ETHERNET;
+ else if (strncmp(ifname, "ctc", 3) == 0)
+ result = LINK_ETHERNET;
+ else if (strncmp(ifname, "hsi", 3) == 0)
+ result = LINK_ETHERNET;
+ else if (strncmp(ifname, "ath", 3) == 0)
+ result = LINK_ETHERNET;
else if ((strncmp(ifname, "isdn", 4) == 0) && (isdn_fd != -1)) {
isdnent = isdn_table_lookup(isdnlist, ifname, isdn_fd);
@@ -235,6 +243,7 @@ void adjustpacket(char *tpacket, unsigne
*/
memmove(aligned_buf, *packet, min(SNAPSHOT_LEN, *readlen));
*packet = aligned_buf;
+ break;
default:
*packet = (char *) NULL; /* return a NULL packet to signal */
break; /* an unrecognized link protocol */
@@ -344,9 +353,14 @@ int processpacket(char *tpacket, char **
* Get IPTraf link type based on returned information and move past
* data link header.
*/
- *linktype =
- getlinktype(fromaddr->sll_hatype, ifname, isdnfd, &isdntable);
fromaddr->sll_protocol = ntohs(fromaddr->sll_protocol);
+ if (fromaddr->sll_protocol != ETH_P_8021Q)
+ *linktype =
+ getlinktype(fromaddr->sll_hatype, ifname, isdnfd, &isdntable);
+ else {
+ *linktype = LINK_VLAN;
+ fromaddr->sll_protocol = ntohs(*((unsigned short*)(tpacket+ETH_HLEN+2)));
+ }
adjustpacket(tpacket, *linktype, packet, aligned_buf, br);
if (*packet == NULL)
--- iptraf-3.0.0/src/ifaces.c.interface 2005-09-13 08:42:54.000000000 +0200
+++ iptraf-3.0.0/src/ifaces.c 2008-04-22 15:35:40.000000000 +0200
@@ -32,14 +32,15 @@ details.
#include "error.h"
extern int accept_unsupported_interfaces;
-#define NUM_SUPPORTED_IFACES 26
+#define NUM_SUPPORTED_IFACES 30
extern int daemonized;
char ifaces[][6] =
{ "lo", "eth", "sl", "ppp", "ippp", "plip", "fddi", "isdn", "dvb",
"pvc", "hdlc", "ipsec", "sbni", "tr", "wvlan", "wlan", "sm2", "sm3",
- "pent", "lec", "brg", "tun", "tap", "cipcb", "tunl", "vlan"
+ "pent", "lec", "brg", "tun", "tap", "cipcb", "tunl", "vlan", "hsi",
+ "ctc", "ath", "bond"
};
char *ltrim(char *buf)

View File

@ -1,28 +0,0 @@
--- src/packet.c.orig 2008-03-07 17:56:48.000000000 +0200
+++ src/packet.c 2008-03-07 18:05:41.000000000 +0200
@@ -101,8 +101,8 @@
result = LINK_ETHERNET;
else if (strncmp(ifname, "tun", 3) == 0)
result = LINK_ETHERNET;
- else if (strncmp(ifname, "vlan", 3) == 0)
- result = LINK_VLAN;
+ else if (strncmp(ifname, "vlan", 4) == 0)
+ result = LINK_ETHERNET;
else if (strncmp(ifname, "brg", 3) == 0)
result = LINK_ETHERNET;
else if (strncmp(ifname, "tap", 3) == 0)
@@ -231,14 +231,6 @@
case LINK_IPIP:
*packet = tpacket;
break;
- case LINK_VLAN:
- *packet = tpacket + VLAN_ETH_HLEN;
- readlen -= VLAN_ETH_HLEN;
- /*
- * Move IP datagram into an aligned buffer.
- */
- memmove(aligned_buf, *packet, min(SNAPSHOT_LEN, *readlen));
- *packet = aligned_buf;
default:
*packet = (char *) NULL; /* return a NULL packet to signal */
break; /* an unrecognized link protocol */