summaryrefslogtreecommitdiff
path: root/source/n/tcpdump
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/tcpdump')
-rw-r--r--source/n/tcpdump/libpcap.20-fix-any-intf.diff159
-rw-r--r--source/n/tcpdump/slack-desc4
-rwxr-xr-xsource/n/tcpdump/tcpdump.SlackBuild57
3 files changed, 10 insertions, 210 deletions
diff --git a/source/n/tcpdump/libpcap.20-fix-any-intf.diff b/source/n/tcpdump/libpcap.20-fix-any-intf.diff
deleted file mode 100644
index 84afa682..00000000
--- a/source/n/tcpdump/libpcap.20-fix-any-intf.diff
+++ /dev/null
@@ -1,159 +0,0 @@
-commit 8fa17a5a554aaeb85d3ec4118b45a31f1efd6808
-Author: guy <guy>
-Date: Wed Nov 19 08:20:39 2008 +0000
-
- Fix the handling of the "any" device, including making it reject
- attempts to open it in monitor mode.
----
- pcap-linux.c | 68 ++++++++++++++++++++++++++++++++++++-----------------------
- 1 file changed, 42 insertions(+), 26 deletions(-)
-
---- a/pcap-linux.c
-+++ b/pcap-linux.c
-@@ -297,6 +297,12 @@
- {
- pcap_t *handle;
-
-+ /*
-+ * A null device name is equivalent to the "any" device.
-+ */
-+ if (device == NULL)
-+ device = "any";
-+
- #ifdef HAVE_DAG_API
- if (strstr(device, "dag")) {
- return dag_create(device, ebuf);
-@@ -338,10 +344,9 @@
- struct iwreq ireq;
- #endif
-
-- if (p->opt.source == NULL) {
-+ if (strcmp(p->opt.source, "any") == 0) {
- /*
-- * This is equivalent to the "any" device, and we don't
-- * support monitor mode on it.
-+ * Monitor mode makes no sense on the "any" device.
- */
- return 0;
- }
-@@ -518,12 +523,11 @@
- handle->stats_op = pcap_stats_linux;
-
- /*
-- * NULL and "any" are special devices which give us the hint to
-- * monitor all devices.
-+ * The "any" device is a special device which causes us not
-+ * to bind to a particular device and thus to look at all
-+ * devices.
- */
-- if (!device || strcmp(device, "any") == 0) {
-- device = NULL;
-- handle->md.device = strdup("any");
-+ if (strcmp(device, "any") == 0) {
- if (handle->opt.promisc) {
- handle->opt.promisc = 0;
- /* Just a warning. */
-@@ -531,10 +535,9 @@
- "Promiscuous mode not supported on the \"any\" device");
- status = PCAP_WARNING_PROMISC_NOTSUP;
- }
-+ }
-
-- } else
-- handle->md.device = strdup(device);
--
-+ handle->md.device = strdup(device);
- if (handle->md.device == NULL) {
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "strdup: %s",
- pcap_strerror(errno) );
-@@ -1657,19 +1660,21 @@
- activate_new(pcap_t *handle)
- {
- #ifdef HAVE_PF_PACKET_SOCKETS
-+ const char *device = handle->opt.source;
-+ int is_any_device = (strcmp(device, "any") == 0);
- int sock_fd = -1, arptype, val;
- int err = 0;
- struct packet_mreq mr;
-- const char* device = handle->opt.source;
-
- /*
-- * Open a socket with protocol family packet. If a device is
-- * given we try to open it in raw mode otherwise we use
-- * the cooked interface.
-- */
-- sock_fd = device ?
-- socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))
-- : socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL));
-+ * Open a socket with protocol family packet. If the
-+ * "any" device was specified, we open a SOCK_DGRAM
-+ * socket for the cooked interface, otherwise we first
-+ * try a SOCK_RAW socket for the raw interface.
-+ */
-+ sock_fd = is_any_device ?
-+ socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL)) :
-+ socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
-
- if (sock_fd == -1) {
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
-@@ -1704,7 +1709,7 @@
- * to cooked mode if we have an unknown interface type
- * or a type we know doesn't work well in raw mode.
- */
-- if (device) {
-+ if (!is_any_device) {
- /* Assume for now we don't need cooked mode. */
- handle->md.cooked = 0;
-
-@@ -1819,15 +1824,23 @@
- }
- } else {
- /*
-- * This is cooked mode.
-+ * The "any" device.
-+ */
-+ if (handle->opt.rfmon) {
-+ /*
-+ * It doesn't support monitor mode.
-+ */
-+ return PCAP_ERROR_RFMON_NOTSUP;
-+ }
-+
-+ /*
-+ * It uses cooked mode.
- */
- handle->md.cooked = 1;
- handle->linktype = DLT_LINUX_SLL;
-
- /*
- * We're not bound to a device.
-- * XXX - true? Or true only if we're using
-- * the "any" device?
- * For now, we're using this as an indication
- * that we can't transmit; stop doing that only
- * if we figure out how to transmit in cooked
-@@ -1852,10 +1865,13 @@
-
- /*
- * Hmm, how can we set promiscuous mode on all interfaces?
-- * I am not sure if that is possible at all.
-+ * I am not sure if that is possible at all. For now, we
-+ * silently ignore attempts to turn promiscuous mode on
-+ * for the "any" device (so you don't have to explicitly
-+ * disable it in programs such as tcpdump).
- */
-
-- if (device && handle->opt.promisc) {
-+ if (!is_any_device && handle->opt.promisc) {
- memset(&mr, 0, sizeof(mr));
- mr.mr_ifindex = handle->md.ifindex;
- mr.mr_type = PACKET_MR_PROMISC;
-@@ -3118,7 +3134,7 @@
-
- /* Bind to the given device */
-
-- if (!device) {
-+ if (strcmp(device, "any") == 0) {
- strncpy(handle->errbuf, "pcap_activate: The \"any\" device isn't supported on 2.0[.x]-kernel systems",
- PCAP_ERRBUF_SIZE);
- return PCAP_ERROR;
diff --git a/source/n/tcpdump/slack-desc b/source/n/tcpdump/slack-desc
index 47bab9e7..1adda180 100644
--- a/source/n/tcpdump/slack-desc
+++ b/source/n/tcpdump/slack-desc
@@ -6,14 +6,14 @@
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
-tcpdump: tcpdump (network monitor)
+tcpdump: tcpdump (network monitoring tool)
tcpdump:
tcpdump: Tcpdump is a tool for network monitoring and data acquisition. You
tcpdump: can use it to dump information on all the packets on a network that
tcpdump: match a boolean expression. Tcpdump uses libpcap, a system
tcpdump: independent interface for user-level packet capture.
tcpdump:
-tcpdump:
+tcpdump: Project homepage: http://sourceforge.net/projects/tcpdump/
tcpdump:
tcpdump:
tcpdump:
diff --git a/source/n/tcpdump/tcpdump.SlackBuild b/source/n/tcpdump/tcpdump.SlackBuild
index 15715c56..1ff4795f 100755
--- a/source/n/tcpdump/tcpdump.SlackBuild
+++ b/source/n/tcpdump/tcpdump.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,9 +20,9 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=4.0.0
-LIBVER=1.0.0
-BUILD=${BUILD:-2}
+PKGNAM=tcpdump
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.gz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -49,50 +49,6 @@ PKG=$TMP/package-tcpdump
rm -rf $PKG
mkdir -p $TMP $PKG
-echo "+================+"
-echo "| libpcap-$LIBVER |"
-echo "+================+"
-cd $TMP
-rm -rf libpcap-$LIBVER
-tar xvf $CWD/libpcap-$LIBVER.tar.gz || exit 1
-cd libpcap-$LIBVER || exit 1
-
-zcat $CWD/libpcap.20-fix-any-intf.diff.gz | patch -p1 --verbose || exit 1
-
-find . -type d -name CVS -depth -exec rm -rf {} \;
-chown -R root:root .
-find . \
- \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
- -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
- -exec chmod 644 {} \;
-CFLAGS="$(getconf LFS_CFLAGS)" \
-./configure \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --mandir=/usr/man \
- --docdir=/usr/doc/libpcap-$LIBVER \
- --enable-ipv6 \
- --build=$ARCH-slackware-linux
-make $NUMJOBS || make || exit 1
-make shared $NUMJOBS || make || exit 1
-mkdir -p $PKG/usr/bin # otherwise it errors out on install
-make install DESTDIR=$PKG || exit 1
-strip --strip-debug libpcap.so.1.?.?
-cp libpcap.so.?.?.? $PKG/usr/lib${LIBDIRSUFFIX}
-( cd $PKG/usr/lib${LIBDIRSUFFIX}
- ln -sf libpcap.so.1.?.? libpcap.so.1
- ln -sf libpcap.so.1 libpcap.so.0
- ln -sf libpcap.so.1 libpcap.so
-)
-mkdir -p $PKG/usr/doc/libpcap-$LIBVER
-cp -a \
- CHANGES CREDITS FILES INSTALL.txt LICENSE README README.linux TODO VERSION \
- $PKG/usr/doc/libpcap-$LIBVER
-
-echo "+================+"
-echo "| tcpdump-$VERSION |"
-echo "+================+"
cd $TMP
rm -rf tcpdump-$VERSION
tar xvf $CWD/tcpdump-$VERSION.tar.gz || exit 1
@@ -104,6 +60,7 @@ find . \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
@@ -113,14 +70,16 @@ find . \
--build=$ARCH-slackware-linux
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
+
# Strange, two identical files:
( cd $PKG/usr/sbin
rm -f tcpdump
ln -s tcpdump.$VERSION tcpdump
) || exit 1
+
mkdir -p $PKG/usr/doc/tcpdump-$VERSION
cp -a \
- CHANGES FILES INSTALL README \
+ CHANGES CREDITS FILES INSTALL.txt LICENSE README* VERSION \
$PKG/usr/doc/tcpdump-$VERSION
find $PKG | xargs file | grep -e "executable" -e "shared object" \