From 9c595ec890be09d12f633c41fe954081f38dca3a Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 7 Jul 2010 01:09:45 +0000 Subject: [PATCH] [packages] tcpdump: properly handle iface names with leading digits (#7572) SVN-Revision: 22081 --- net/tcpdump/Makefile | 2 +- net/tcpdump/patches/004-fix_3g_iface.patch | 28 ++++++++++++++++++++++ net/tcpdump/patches/100-tcpdump_mini.patch | 12 +++++----- 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 net/tcpdump/patches/004-fix_3g_iface.patch diff --git a/net/tcpdump/Makefile b/net/tcpdump/Makefile index 5110fb3c31..473573369a 100644 --- a/net/tcpdump/Makefile +++ b/net/tcpdump/Makefile @@ -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 index 0000000000..668cf4f34b --- /dev/null +++ b/net/tcpdump/patches/004-fix_3g_iface.patch @@ -0,0 +1,28 @@ +--- a/tcpdump.c ++++ b/tcpdump.c +@@ -66,6 +66,7 @@ extern int SIZE_BUF; + #include + #include + #include ++#include + #ifndef WIN32 + #include + #include +@@ -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"); + diff --git a/net/tcpdump/patches/100-tcpdump_mini.patch b/net/tcpdump/patches/100-tcpdump_mini.patch index 9e97593d74..69abbefc07 100644 --- a/net/tcpdump/patches/100-tcpdump_mini.patch +++ b/net/tcpdump/patches/100-tcpdump_mini.patch @@ -206,7 +206,7 @@ if (!eflag) --- a/tcpdump.c +++ b/tcpdump.c -@@ -138,11 +138,14 @@ struct printer { +@@ -139,11 +139,14 @@ struct printer { }; static struct printer printers[] = { @@ -221,7 +221,7 @@ { 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 @@ -245,7 +245,7 @@ { 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 @@ -265,7 +265,7 @@ #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 @@ -280,7 +280,7 @@ #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 @@ -292,7 +292,7 @@ #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 -- 2.30.2