[packages] tcpdump: properly handle iface names with leading digits (#7572)
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 7 Jul 2010 01:09:45 +0000 (01:09 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 7 Jul 2010 01:09:45 +0000 (01:09 +0000)
SVN-Revision: 22081

net/tcpdump/Makefile
net/tcpdump/patches/004-fix_3g_iface.patch [new file with mode: 0644]
net/tcpdump/patches/100-tcpdump_mini.patch

index 5110fb3c314b62f0d4a00c48ca0ab2ca65a57c4e..473573369a5f98243b505d0c05a3ffdb973c834e 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tcpdump
 PKG_VERSION:=4.0.0
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.tcpdump.org/release/ \
diff --git a/net/tcpdump/patches/004-fix_3g_iface.patch b/net/tcpdump/patches/004-fix_3g_iface.patch
new file mode 100644 (file)
index 0000000..668cf4f
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/tcpdump.c
++++ b/tcpdump.c
+@@ -66,6 +66,7 @@ extern int SIZE_BUF;
+ #include <stdlib.h>
+ #include <string.h>
+ #include <limits.h>
++#include <ctype.h>
+ #ifndef WIN32
+ #include <sys/wait.h>
+ #include <sys/resource.h>
+@@ -501,6 +502,7 @@ main(int argc, char **argv)
+ #ifdef HAVE_PCAP_FINDALLDEVS
+       pcap_if_t *devpointer;
+       int devnum;
++      char *devp;
+ #endif
+       int status;
+ #ifdef WIN32
+@@ -639,7 +641,8 @@ main(int argc, char **argv)
+                        * It can be useful on Windows, where more than
+                        * one interface can have the same name.
+                        */
+-                      if ((devnum = atoi(optarg)) != 0) {
++                      for (devp = optarg; *devp && isdigit(*devp); devp++);
++                      if ((!*devp || isspace(*devp)) && (devnum = atoi(optarg)) != 0) {
+                               if (devnum < 0)
+                                       error("Invalid adapter index");
index 9e97593d74aae06f4eab82bfeba5e7f101e912e3..69abbefc07e8203989bf59439a9a844ac58f80ad 100644 (file)
                if (!eflag)
 --- a/tcpdump.c
 +++ b/tcpdump.c
-@@ -138,11 +138,14 @@ struct printer {
+@@ -139,11 +139,14 @@ struct printer {
  };
  
  static struct printer printers[] = {
        { token_if_print,       DLT_IEEE802 },
  #ifdef DLT_LANE8023
        { lane_if_print,        DLT_LANE8023 },
-@@ -157,19 +160,23 @@ static struct printer printers[] = {
+@@ -158,19 +161,23 @@ static struct printer printers[] = {
  #ifdef DLT_SLIP_BSDOS
        { sl_bsdos_if_print,    DLT_SLIP_BSDOS },
  #endif
        { atm_if_print,         DLT_ATM_RFC1483 },
  #ifdef DLT_C_HDLC
        { chdlc_if_print,       DLT_C_HDLC },
-@@ -180,15 +187,19 @@ static struct printer printers[] = {
+@@ -181,15 +188,19 @@ static struct printer printers[] = {
  #ifdef DLT_PPP_SERIAL
        { ppp_hdlc_if_print,    DLT_PPP_SERIAL },
  #endif
  #ifdef DLT_LTALK
        { ltalk_if_print,       DLT_LTALK },
  #endif
-@@ -207,12 +218,14 @@ static struct printer printers[] = {
+@@ -208,12 +219,14 @@ static struct printer printers[] = {
  #ifdef DLT_IP_OVER_FC
        { ipfc_if_print,        DLT_IP_OVER_FC },
  #endif
  #ifdef DLT_ENC
        { enc_if_print,         DLT_ENC },
  #endif
-@@ -222,9 +235,11 @@ static struct printer printers[] = {
+@@ -223,9 +236,11 @@ static struct printer printers[] = {
  #ifdef DLT_APPLE_IP_OVER_IEEE1394
        { ap1394_if_print,      DLT_APPLE_IP_OVER_IEEE1394 },
  #endif
  #ifdef DLT_JUNIPER_ATM1
        { juniper_atm1_print,   DLT_JUNIPER_ATM1 },
  #endif
-@@ -276,6 +291,7 @@ static struct printer printers[] = {
+@@ -277,6 +292,7 @@ static struct printer printers[] = {
  #if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
        { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
  #endif