From 0b985c05a9535cce3fbdf5bf93475626b6a96430 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 7 Mar 2005 16:08:45 +0000 Subject: add libpcap git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@338 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Config.in | 7 +++ package/libpcap/Makefile | 60 +++++++++++++++++++++++++ package/libpcap/patches/cross-compile-fix.patch | 11 +++++ 3 files changed, 78 insertions(+) create mode 100644 package/libpcap/Config.in create mode 100644 package/libpcap/Makefile create mode 100644 package/libpcap/patches/cross-compile-fix.patch (limited to 'package/libpcap') diff --git a/package/libpcap/Config.in b/package/libpcap/Config.in new file mode 100644 index 000000000..7aa6a5b5b --- /dev/null +++ b/package/libpcap/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_LIBPCAP + bool "libpcap" + default n + help + A system-independent library for user-level network packet capture. + + http://www.tcpdump.org/ diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile new file mode 100644 index 000000000..279190c02 --- /dev/null +++ b/package/libpcap/Makefile @@ -0,0 +1,60 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME := libpcap +PKG_VERSION := 0.8.3 +PKG_RELEASE := 1 + +PKG_SOURCE_SITE := http://www.tcpdump.org/release +PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_CAT := zcat +PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR) + + +$(DL_DIR)/$(PKG_SOURCE_FILE): + mkdir -p $(DL_DIR) + $(WGET) -P $(DL_DIR) $(PKG_SOURCE_SITE)/$(PKG_SOURCE_FILE) + +$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE) + mkdir -p $(TOOL_BUILD_DIR) + $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + $(PATCH) $(PKG_BUILD_DIR) . ./patches + touch $(PKG_BUILD_DIR)/.patched + +$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched + (cd $(PKG_BUILD_DIR); rm -rf config.cache; \ + ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \ + BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --with-build-cc=$(HOSTCC) \ + --disable-yydebug \ + --prefix=/usr \ + --with-pcap=linux \ + ); + touch $(PKG_BUILD_DIR)/.configured + +$(PKG_BUILD_DIR)/libpcap.a: $(PKG_BUILD_DIR)/.configured + $(MAKE) AR="$(TARGET_CROSS)ar" -C $(PKG_BUILD_DIR) + +$(STAGING_DIR)/lib/libpcap.a: $(PKG_BUILD_DIR)/libpcap.a + $(MAKE) -C $(PKG_BUILD_DIR) \ + prefix=$(STAGING_DIR) \ + exec_prefix=$(STAGING_DIR) \ + bindir=$(STAGING_DIR)/bin \ + datadir=$(STAGING_DIR)/share \ + install + +source: $(DL_DIR)/$(PKG_SOURCE_FILE) +prepare: $(PKG_BUILD_DIR)/.patched +compile: $(STAGING_DIR)/lib/libpcap.a +install: + +clean: + rm -rf $(PKG_BUILD_DIR) + rm -f $(STAGING_DIR)/lib/libpcap* + diff --git a/package/libpcap/patches/cross-compile-fix.patch b/package/libpcap/patches/cross-compile-fix.patch new file mode 100644 index 000000000..196ee34eb --- /dev/null +++ b/package/libpcap/patches/cross-compile-fix.patch @@ -0,0 +1,11 @@ +--- libpcap-0.8.3/Makefile.in.orig 2005-01-17 19:04:41.291056960 -0500 ++++ libpcap-0.8.3/Makefile.in 2005-01-17 19:04:47.836061968 -0500 +@@ -100,7 +100,7 @@ + + libpcap.a: $(OBJ) + @rm -f $@ +- ar rc $@ $(OBJ) $(LIBS) ++ $(AR) rc $@ $(OBJ) $(LIBS) + $(RANLIB) $@ + + scanner.c: $(srcdir)/scanner.l -- cgit v1.2.3 From 0d52ac0f6a06a36bc0f0316b8593f1f8dc3a8a53 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 19 Mar 2005 22:51:51 +0000 Subject: add downloading script (with md5sum checking and sourceforge downloading support) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@391 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 279190c02..6d0dfafe7 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -13,7 +13,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR) $(DL_DIR)/$(PKG_SOURCE_FILE): mkdir -p $(DL_DIR) - $(WGET) -P $(DL_DIR) $(PKG_SOURCE_SITE)/$(PKG_SOURCE_FILE) + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) x $(PKG_SOURCE_SITE) $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE) mkdir -p $(TOOL_BUILD_DIR) -- cgit v1.2.3 From df1d9706f4e8dc21c18dd210c16cef8620ca7efe Mon Sep 17 00:00:00 2001 From: wbx Date: Mon, 21 Mar 2005 08:12:49 +0000 Subject: add md5sums git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@405 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 6d0dfafe7..e9276367b 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -1,8 +1,11 @@ +# $Id$ + include $(TOPDIR)/rules.mk PKG_NAME := libpcap PKG_VERSION := 0.8.3 PKG_RELEASE := 1 +PKG_MD5SUM := 56a9d4615d8354fcfe8cff8c8443c77b PKG_SOURCE_SITE := http://www.tcpdump.org/release PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -10,10 +13,9 @@ PKG_SOURCE_CAT := zcat PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR) - $(DL_DIR)/$(PKG_SOURCE_FILE): mkdir -p $(DL_DIR) - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) x $(PKG_SOURCE_SITE) + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) $(PKG_MD5SUM) $(PKG_SOURCE_SITE) $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE) mkdir -p $(TOOL_BUILD_DIR) @@ -57,4 +59,3 @@ install: clean: rm -rf $(PKG_BUILD_DIR) rm -f $(STAGING_DIR)/lib/libpcap* - -- cgit v1.2.3 From b4e465c6fbdab58ae67827e034483a7003846fd4 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 30 Mar 2005 14:43:56 +0000 Subject: Make libpcap shared git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@476 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Config.in | 4 +- package/libpcap/Makefile | 52 +++++++-- package/libpcap/ipkg/libpcap.control | 8 ++ package/libpcap/patches/100-shared-lib.patch | 117 +++++++++++++++++++++ .../libpcap/patches/101-cross-compile-fix.patch | 11 ++ package/libpcap/patches/102-alt-ether.patch | 39 +++++++ package/libpcap/patches/cross-compile-fix.patch | 11 -- 7 files changed, 218 insertions(+), 24 deletions(-) create mode 100644 package/libpcap/ipkg/libpcap.control create mode 100644 package/libpcap/patches/100-shared-lib.patch create mode 100644 package/libpcap/patches/101-cross-compile-fix.patch create mode 100644 package/libpcap/patches/102-alt-ether.patch delete mode 100644 package/libpcap/patches/cross-compile-fix.patch (limited to 'package/libpcap') diff --git a/package/libpcap/Config.in b/package/libpcap/Config.in index 7aa6a5b5b..0c115212e 100644 --- a/package/libpcap/Config.in +++ b/package/libpcap/Config.in @@ -1,6 +1,6 @@ config BR2_PACKAGE_LIBPCAP - bool "libpcap" - default n + tristate "libpcap (a low-level packet capture library)" + default m help A system-independent library for user-level network packet capture. diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index e9276367b..98806c283 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -12,6 +12,8 @@ PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_CAT := zcat PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR) +PKG_IPK := $(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg $(DL_DIR)/$(PKG_SOURCE_FILE): mkdir -p $(DL_DIR) @@ -20,7 +22,7 @@ $(DL_DIR)/$(PKG_SOURCE_FILE): $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE) mkdir -p $(TOOL_BUILD_DIR) $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - $(PATCH) $(PKG_BUILD_DIR) . ./patches + $(PATCH) $(PKG_BUILD_DIR) ./patches touch $(PKG_BUILD_DIR)/.patched $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched @@ -33,29 +35,57 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched --target=$(GNU_TARGET_NAME) \ --host=$(GNU_TARGET_NAME) \ --build=$(GNU_HOST_NAME) \ - --with-build-cc=$(HOSTCC) \ - --disable-yydebug \ + --program-prefix="" \ + --program-suffix="" \ --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + --enable-shared \ + --enable-static \ + --disable-yydebug \ + --with-build-cc=$(HOSTCC) \ --with-pcap=linux \ ); touch $(PKG_BUILD_DIR)/.configured $(PKG_BUILD_DIR)/libpcap.a: $(PKG_BUILD_DIR)/.configured - $(MAKE) AR="$(TARGET_CROSS)ar" -C $(PKG_BUILD_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CCOPT="$(TARGET_CFLAGS)" \ -$(STAGING_DIR)/lib/libpcap.a: $(PKG_BUILD_DIR)/libpcap.a +$(STAGING_DIR)/usr/lib/libpcap.a: $(PKG_BUILD_DIR)/libpcap.a $(MAKE) -C $(PKG_BUILD_DIR) \ - prefix=$(STAGING_DIR) \ - exec_prefix=$(STAGING_DIR) \ - bindir=$(STAGING_DIR)/bin \ - datadir=$(STAGING_DIR)/share \ + DESTDIR="$(STAGING_DIR)" \ install +$(PKG_IPK): $(STAGING_DIR)/usr/lib/libpcap.a + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) ./ipkg/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + mkdir -p $(PKG_IPK_DIR)/usr/lib + cp -fpR $(STAGING_DIR)/usr/lib/libpcap.so.* $(PKG_IPK_DIR)/usr/lib/ + $(STRIP) $(PKG_IPK_DIR)/usr/lib/* + mkdir -p $(PACKAGE_DIR) + $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) + $(IPKG) install $(PKG_IPK) + source: $(DL_DIR)/$(PKG_SOURCE_FILE) prepare: $(PKG_BUILD_DIR)/.patched compile: $(STAGING_DIR)/lib/libpcap.a -install: +install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list clean: + -$(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(STAGING_DIR)" \ + uninstall clean rm -rf $(PKG_BUILD_DIR) - rm -f $(STAGING_DIR)/lib/libpcap* + rm -f $(PKG_IPK) diff --git a/package/libpcap/ipkg/libpcap.control b/package/libpcap/ipkg/libpcap.control new file mode 100644 index 000000000..4251be809 --- /dev/null +++ b/package/libpcap/ipkg/libpcap.control @@ -0,0 +1,8 @@ +Package: libpcap +Priority: optional +Section: libs +Version: [TBDL] +Architecture: [TBDL] +Maintainer: Nico +Source: http://nthill.free.fr/openwrt/sources/libpcap/ +Description: a low-level packet capture library diff --git a/package/libpcap/patches/100-shared-lib.patch b/package/libpcap/patches/100-shared-lib.patch new file mode 100644 index 000000000..fbbef5b67 --- /dev/null +++ b/package/libpcap/patches/100-shared-lib.patch @@ -0,0 +1,117 @@ +--- libpcap-0.8.3-orig/Makefile.in 2003-12-15 02:42:23.000000000 +0100 ++++ libpcap-0.8.3-7/Makefile.in 2005-03-08 03:38:22.000000000 +0100 +@@ -37,6 +37,15 @@ + srcdir = @srcdir@ + VPATH = @srcdir@ + ++# some defines for shared library compilation ++MAJ=0.8 ++MIN=3 ++VERSION=$(MAJ).$(MIN) ++LIBNAME=pcap ++LIBRARY=lib$(LIBNAME).a ++SOLIBRARY=lib$(LIBNAME).so ++SHAREDLIB=$(SOLIBRARY).$(VERSION) ++ + # + # You shouldn't need to edit anything below. + # +@@ -49,6 +58,7 @@ + + # Standard CFLAGS + CFLAGS = $(CCOPT) $(INCLS) $(DEFS) ++CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) + + INSTALL = @INSTALL@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -68,7 +78,11 @@ + # problem if you don't own the file but can write to the directory. + .c.o: + @rm -f $@ +- $(CC) $(CFLAGS) -c $(srcdir)/$*.c ++ $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c ++ ++%_pic.o: %.c ++ @rm -f $@ ++ $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c + + PSRC = pcap-@V_PCAP@.c + FSRC = fad-@V_FINDALLDEVS@.c +@@ -83,6 +97,7 @@ + # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot + # hack the extra indirection + OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) ++OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) + HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \ + ethertype.h gencode.h gnuc.h + GENHDR = \ +@@ -94,15 +109,22 @@ + TAGFILES = \ + $(SRC) $(HDR) $(TAGHDR) + +-CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c ++CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so* + +-all: libpcap.a ++all: libpcap.a $(SHAREDLIB) + + libpcap.a: $(OBJ) + @rm -f $@ + ar rc $@ $(OBJ) $(LIBS) + $(RANLIB) $@ + ++$(SHAREDLIB): $(OBJ_PIC) ++ -@rm -f $@ ++ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ) ++ $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc ++ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) ++ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) ++ + scanner.c: $(srcdir)/scanner.l + @rm -f $@ + $(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@ +@@ -110,6 +132,9 @@ + scanner.o: scanner.c tokdefs.h + $(CC) $(CFLAGS) -c scanner.c + ++scanner_pic.o: scanner.c tokdefs.h ++ $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c ++ + pcap.o: version.h + + tokdefs.h: grammar.c +@@ -123,9 +148,17 @@ + @rm -f $@ + $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c + ++grammar_pic.o: grammar.c ++ @rm -f $@ ++ $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c ++ + version.o: version.c + $(CC) $(CFLAGS) -c version.c + ++version_pic.o: version.c ++ $(CC) -fPIC $(CFLAGS) -c version.c -o $@ ++ ++ + snprintf.o: $(srcdir)/missing/snprintf.c + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c + +@@ -151,10 +184,16 @@ + bpf_filter.o: bpf_filter.c + $(CC) $(CFLAGS) -c bpf_filter.c + ++bpf_filter_pic.o: bpf_filter.c ++ $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@ ++ + install: + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a ++ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/ ++ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ) ++ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY) + $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a + [ -d $(DESTDIR)$(includedir) ] || \ + (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir)) diff --git a/package/libpcap/patches/101-cross-compile-fix.patch b/package/libpcap/patches/101-cross-compile-fix.patch new file mode 100644 index 000000000..196ee34eb --- /dev/null +++ b/package/libpcap/patches/101-cross-compile-fix.patch @@ -0,0 +1,11 @@ +--- libpcap-0.8.3/Makefile.in.orig 2005-01-17 19:04:41.291056960 -0500 ++++ libpcap-0.8.3/Makefile.in 2005-01-17 19:04:47.836061968 -0500 +@@ -100,7 +100,7 @@ + + libpcap.a: $(OBJ) + @rm -f $@ +- ar rc $@ $(OBJ) $(LIBS) ++ $(AR) rc $@ $(OBJ) $(LIBS) + $(RANLIB) $@ + + scanner.c: $(srcdir)/scanner.l diff --git a/package/libpcap/patches/102-alt-ether.patch b/package/libpcap/patches/102-alt-ether.patch new file mode 100644 index 000000000..d5e010ec6 --- /dev/null +++ b/package/libpcap/patches/102-alt-ether.patch @@ -0,0 +1,39 @@ +--- libpcap-0.8.3-orig/nametoaddr.c 2003-11-19 19:13:48.000000000 +0100 ++++ libpcap-0.8.3-7/nametoaddr.c 2005-03-08 03:38:22.000000000 +0100 +@@ -333,7 +333,7 @@ + e = ep = (u_char *)malloc(6); + + while (*s) { +- if (*s == ':') ++ if (*s == ':' || *s == '.') + s += 1; + d = xdtoi(*s++); + if (isxdigit((unsigned char)*s)) { +--- libpcap-0.8.3-orig/scanner.l 2004-03-28 23:45:33.000000000 +0200 ++++ libpcap-0.8.3-7/scanner.l 2005-03-08 03:38:22.000000000 +0100 +@@ -80,6 +80,7 @@ + N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) + B ([0-9A-Fa-f][0-9A-Fa-f]?) + W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) ++X [0-9A-Fa-f] + + %a 16000 + %o 19000 +@@ -296,7 +297,7 @@ + {N} { yylval.i = stoi((char *)yytext); return NUM; } + ({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { + yylval.s = sdup((char *)yytext); return HID; } +-{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext); ++({B}:{B}:{B}:{B}:{B}:{B})|({B}\.{B}\.{B}\.{B}\.{B}\.{B}) { yylval.e = pcap_ether_aton((char *)yytext); + return EID; } + {V6} { + #ifdef INET6 +@@ -314,6 +315,8 @@ + #endif /*INET6*/ + } + {B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } ++{X}{12} { yylval.e = pcap_ether_aton((char *)yytext); return EID;} ++ + icmptype { yylval.i = 0; return NUM; } + icmpcode { yylval.i = 1; return NUM; } + icmp-echoreply { yylval.i = 0; return NUM; } diff --git a/package/libpcap/patches/cross-compile-fix.patch b/package/libpcap/patches/cross-compile-fix.patch deleted file mode 100644 index 196ee34eb..000000000 --- a/package/libpcap/patches/cross-compile-fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libpcap-0.8.3/Makefile.in.orig 2005-01-17 19:04:41.291056960 -0500 -+++ libpcap-0.8.3/Makefile.in 2005-01-17 19:04:47.836061968 -0500 -@@ -100,7 +100,7 @@ - - libpcap.a: $(OBJ) - @rm -f $@ -- ar rc $@ $(OBJ) $(LIBS) -+ $(AR) rc $@ $(OBJ) $(LIBS) - $(RANLIB) $@ - - scanner.c: $(srcdir)/scanner.l -- cgit v1.2.3 From 52f3809489073694ff4af026783ebfcebad0b1c2 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 30 Mar 2005 15:31:23 +0000 Subject: Fix libpcap compile git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@477 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 98806c283..1980429d8 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -80,7 +80,7 @@ $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) source: $(DL_DIR)/$(PKG_SOURCE_FILE) prepare: $(PKG_BUILD_DIR)/.patched -compile: $(STAGING_DIR)/lib/libpcap.a +compile: $(STAGING_DIR)/usr/lib/libpcap.a install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list clean: -- cgit v1.2.3 From da0520760c404d28e435344774d27742f86d18ac Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 1 Apr 2005 16:49:24 +0000 Subject: build libpcap package git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@504 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 1980429d8..e9144a6cf 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -80,7 +80,7 @@ $(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) source: $(DL_DIR)/$(PKG_SOURCE_FILE) prepare: $(PKG_BUILD_DIR)/.patched -compile: $(STAGING_DIR)/usr/lib/libpcap.a +compile: $(STAGING_DIR)/usr/lib/libpcap.a $(PKG_IPK) install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list clean: -- cgit v1.2.3 From 7e039b5de1a77684d3e8a8d78cebc6124e552c9f Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 14 Apr 2005 06:17:27 +0000 Subject: Uniformize package Makefile, Build in a separate directory so that arpwatch and tcpdump configure wont find it git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@642 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 87 +++++++++++++++++++----------------- package/libpcap/ipkg/libpcap.control | 8 ---- package/libpcap/libpcap.control | 8 ++++ 3 files changed, 54 insertions(+), 49 deletions(-) delete mode 100644 package/libpcap/ipkg/libpcap.control create mode 100644 package/libpcap/libpcap.control (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index e9144a6cf..974d9afc4 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -2,35 +2,39 @@ include $(TOPDIR)/rules.mk -PKG_NAME := libpcap -PKG_VERSION := 0.8.3 -PKG_RELEASE := 1 -PKG_MD5SUM := 56a9d4615d8354fcfe8cff8c8443c77b +PKG_NAME:=libpcap +PKG_VERSION:=0.8.3 +PKG_RELEASE:=1 +PKG_MD5SUM:=56a9d4615d8354fcfe8cff8c8443c77b -PKG_SOURCE_SITE := http://www.tcpdump.org/release -PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_CAT := zcat -PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION) -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR) -PKG_IPK := $(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk -PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg +PKG_SOURCE_URL:= \ + http://www.tcpdump.org/release \ + http://nthill.free.fr/openwrt/sources/$(PKG_NAME)/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_CAT:=zcat -$(DL_DIR)/$(PKG_SOURCE_FILE): - mkdir -p $(DL_DIR) - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) $(PKG_MD5SUM) $(PKG_SOURCE_SITE) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) -$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE) - mkdir -p $(TOOL_BUILD_DIR) - $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - +IPKG_LIBPCAP:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +IDIR_LIBPCAP:=$(PKG_BUILD_DIR)/ipkg/$(PKG_NAME) +INFO_LIBPCAP:=$(IPKG_STATE_DIR)/info/$(PKG_NAME).list + +$(DL_DIR)/$(PKG_SOURCE): + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL) + +$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE) + mkdir -p $(BUILD_DIR)/$(PKG_NAME) + $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR)/$(PKG_NAME) $(TAR_OPTIONS) - $(PATCH) $(PKG_BUILD_DIR) ./patches - touch $(PKG_BUILD_DIR)/.patched + touch $(PKG_BUILD_DIR)/.prepared -$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched - (cd $(PKG_BUILD_DIR); rm -rf config.cache; \ - ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \ - BUILD_CC=$(TARGET_CC) HOSTCC=$(HOSTCC) \ +$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared + (cd $(PKG_BUILD_DIR); rm -rf config.cache config.status; \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ + ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \ ./configure \ --target=$(GNU_TARGET_NAME) \ --host=$(GNU_TARGET_NAME) \ @@ -49,6 +53,8 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched --mandir=/usr/share/man \ --sbindir=/usr/sbin \ --sysconfdir=/etc \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ --enable-shared \ --enable-static \ --disable-yydebug \ @@ -57,35 +63,34 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched ); touch $(PKG_BUILD_DIR)/.configured -$(PKG_BUILD_DIR)/libpcap.a: $(PKG_BUILD_DIR)/.configured +$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured $(MAKE) -C $(PKG_BUILD_DIR) \ - $(TARGET_CONFIGURE_OPTS) \ - CCOPT="$(TARGET_CFLAGS)" \ + CCOPT="$(TARGET_CFLAGS)" + touch $(PKG_BUILD_DIR)/.built -$(STAGING_DIR)/usr/lib/libpcap.a: $(PKG_BUILD_DIR)/libpcap.a +$(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built $(MAKE) -C $(PKG_BUILD_DIR) \ DESTDIR="$(STAGING_DIR)" \ install -$(PKG_IPK): $(STAGING_DIR)/usr/lib/libpcap.a - $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) ./ipkg/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) - mkdir -p $(PKG_IPK_DIR)/usr/lib - cp -fpR $(STAGING_DIR)/usr/lib/libpcap.so.* $(PKG_IPK_DIR)/usr/lib/ - $(STRIP) $(PKG_IPK_DIR)/usr/lib/* +$(IPKG_LIBPCAP): $(STAGING_DIR)/usr/lib/libpcap.so + $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_LIBPCAP) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + mkdir -p $(IDIR_LIBPCAP)/usr/lib + cp -fpR $(STAGING_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/ + $(STRIP) $(IDIR_LIBPCAP)/usr/lib/lib*.so* mkdir -p $(PACKAGE_DIR) - $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR) + $(IPKG_BUILD) $(IDIR_LIBPCAP) $(PACKAGE_DIR) -$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) - $(IPKG) install $(PKG_IPK) +$(INFO_LIBPCAP): $(IPKG_LIBPCAP) + $(IPKG) install $(IPKG_LIBPCAP) -source: $(DL_DIR)/$(PKG_SOURCE_FILE) -prepare: $(PKG_BUILD_DIR)/.patched -compile: $(STAGING_DIR)/usr/lib/libpcap.a $(PKG_IPK) -install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list +source: $(DL_DIR)/$(PKG_SOURCE) +prepare: $(PKG_BUILD_DIR)/.prepared +compile: $(IPKG_LIBPCAP) +install: $(INFO_LIBPCAP) clean: -$(MAKE) -C $(PKG_BUILD_DIR) \ DESTDIR="$(STAGING_DIR)" \ - uninstall clean - rm -rf $(PKG_BUILD_DIR) - rm -f $(PKG_IPK) + uninstall + rm -rf $(PKG_BUILD_DIR) $(IPKG_LIBPCAP) diff --git a/package/libpcap/ipkg/libpcap.control b/package/libpcap/ipkg/libpcap.control deleted file mode 100644 index 4251be809..000000000 --- a/package/libpcap/ipkg/libpcap.control +++ /dev/null @@ -1,8 +0,0 @@ -Package: libpcap -Priority: optional -Section: libs -Version: [TBDL] -Architecture: [TBDL] -Maintainer: Nico -Source: http://nthill.free.fr/openwrt/sources/libpcap/ -Description: a low-level packet capture library diff --git a/package/libpcap/libpcap.control b/package/libpcap/libpcap.control new file mode 100644 index 000000000..4251be809 --- /dev/null +++ b/package/libpcap/libpcap.control @@ -0,0 +1,8 @@ +Package: libpcap +Priority: optional +Section: libs +Version: [TBDL] +Architecture: [TBDL] +Maintainer: Nico +Source: http://nthill.free.fr/openwrt/sources/libpcap/ +Description: a low-level packet capture library -- cgit v1.2.3 From 2d2de20c87800851bdfde176239df326bd79ea50 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 18 Apr 2005 19:45:56 +0000 Subject: disable non-essential packages by default if DEVELOPER is unset on make menuconfig git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@675 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Config.in b/package/libpcap/Config.in index 0c115212e..4f97c3ecd 100644 --- a/package/libpcap/Config.in +++ b/package/libpcap/Config.in @@ -1,6 +1,6 @@ config BR2_PACKAGE_LIBPCAP tristate "libpcap (a low-level packet capture library)" - default m + default m if CONFIG_DEVEL help A system-independent library for user-level network packet capture. -- cgit v1.2.3 From 8d0bb89ddba5b4f2d33fc36f4dbfd9022c2f7051 Mon Sep 17 00:00:00 2001 From: nico Date: Mon, 18 Apr 2005 22:21:01 +0000 Subject: Change libpcap, uniformize package makefile, put back control file in ./ipkg git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@682 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 56 ++++++++++++++++++------------------ package/libpcap/ipkg/libpcap.control | 8 ++++++ package/libpcap/libpcap.control | 8 ------ 3 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 package/libpcap/ipkg/libpcap.control delete mode 100644 package/libpcap/libpcap.control (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 974d9afc4..0a0e5181f 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -29,37 +29,37 @@ $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE) touch $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared - (cd $(PKG_BUILD_DIR); rm -rf config.cache config.status; \ + (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS)" \ CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \ ./configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_TARGET_NAME) \ - --build=$(GNU_HOST_NAME) \ - --program-prefix="" \ - --program-suffix="" \ - --prefix=/usr \ - --exec-prefix=/usr \ - --bindir=/usr/bin \ - --datadir=/usr/share \ - --includedir=/usr/include \ - --infodir=/usr/share/info \ - --libdir=/usr/lib \ - --libexecdir=/usr/lib \ - --localstatedir=/var \ - --mandir=/usr/share/man \ - --sbindir=/usr/sbin \ - --sysconfdir=/etc \ - $(DISABLE_NLS) \ - $(DISABLE_LARGEFILE) \ - --enable-shared \ - --enable-static \ - --disable-yydebug \ - --with-build-cc=$(HOSTCC) \ - --with-pcap=linux \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --enable-shared \ + --enable-static \ + --disable-yydebug \ + --with-build-cc=$(HOSTCC) \ + --with-pcap=linux \ ); touch $(PKG_BUILD_DIR)/.configured @@ -74,10 +74,10 @@ $(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built install $(IPKG_LIBPCAP): $(STAGING_DIR)/usr/lib/libpcap.so - $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_LIBPCAP) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) - mkdir -p $(IDIR_LIBPCAP)/usr/lib + $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_LIBPCAP) ./ipkg/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + install -m0755 -d $(IDIR_LIBPCAP)/usr/lib cp -fpR $(STAGING_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/ - $(STRIP) $(IDIR_LIBPCAP)/usr/lib/lib*.so* + $(RSTRIP) $(IDIR_LIBPCAP) mkdir -p $(PACKAGE_DIR) $(IPKG_BUILD) $(IDIR_LIBPCAP) $(PACKAGE_DIR) diff --git a/package/libpcap/ipkg/libpcap.control b/package/libpcap/ipkg/libpcap.control new file mode 100644 index 000000000..4251be809 --- /dev/null +++ b/package/libpcap/ipkg/libpcap.control @@ -0,0 +1,8 @@ +Package: libpcap +Priority: optional +Section: libs +Version: [TBDL] +Architecture: [TBDL] +Maintainer: Nico +Source: http://nthill.free.fr/openwrt/sources/libpcap/ +Description: a low-level packet capture library diff --git a/package/libpcap/libpcap.control b/package/libpcap/libpcap.control deleted file mode 100644 index 4251be809..000000000 --- a/package/libpcap/libpcap.control +++ /dev/null @@ -1,8 +0,0 @@ -Package: libpcap -Priority: optional -Section: libs -Version: [TBDL] -Architecture: [TBDL] -Maintainer: Nico -Source: http://nthill.free.fr/openwrt/sources/libpcap/ -Description: a low-level packet capture library -- cgit v1.2.3 From 301a8eaf2c2a35b97b27f206eefa95403e323dcd Mon Sep 17 00:00:00 2001 From: nico Date: Fri, 13 May 2005 02:03:35 +0000 Subject: Convert libpcap to new packaging style git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@866 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 50 +++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 30 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 0a0e5181f..89f975344 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -14,19 +14,11 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_CAT:=zcat PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install -IPKG_LIBPCAP:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk -IDIR_LIBPCAP:=$(PKG_BUILD_DIR)/ipkg/$(PKG_NAME) -INFO_LIBPCAP:=$(IPKG_STATE_DIR)/info/$(PKG_NAME).list +include $(TOPDIR)/package/rules.mk -$(DL_DIR)/$(PKG_SOURCE): - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL) - -$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE) - mkdir -p $(BUILD_DIR)/$(PKG_NAME) - $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR)/$(PKG_NAME) $(TAR_OPTIONS) - - $(PATCH) $(PKG_BUILD_DIR) ./patches - touch $(PKG_BUILD_DIR)/.prepared +$(eval $(call PKG_template,LIBPCAP,libpcap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ @@ -66,31 +58,29 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured $(MAKE) -C $(PKG_BUILD_DIR) \ CCOPT="$(TARGET_CFLAGS)" - touch $(PKG_BUILD_DIR)/.built - -$(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built + mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) \ - DESTDIR="$(STAGING_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ install + touch $(PKG_BUILD_DIR)/.built -$(IPKG_LIBPCAP): $(STAGING_DIR)/usr/lib/libpcap.so - $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_LIBPCAP) ./ipkg/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) +$(IPKG_LIBPCAP): install -m0755 -d $(IDIR_LIBPCAP)/usr/lib - cp -fpR $(STAGING_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/ + cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/ $(RSTRIP) $(IDIR_LIBPCAP) - mkdir -p $(PACKAGE_DIR) $(IPKG_BUILD) $(IDIR_LIBPCAP) $(PACKAGE_DIR) -$(INFO_LIBPCAP): $(IPKG_LIBPCAP) - $(IPKG) install $(IPKG_LIBPCAP) +$(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built + mkdir -p $(STAGING_DIR)/usr/include + cp -fpR $(PKG_INSTALL_DIR)/usr/include/pcap* $(STAGING_DIR)/usr/include/ + mkdir -p $(I_LIBPCAP_DEV)/usr/lib + cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(STAGING_DIR)/usr/lib/ + +install-dev: $(STAGING_DIR)/usr/lib/libpcap.so -source: $(DL_DIR)/$(PKG_SOURCE) -prepare: $(PKG_BUILD_DIR)/.prepared -compile: $(IPKG_LIBPCAP) -install: $(INFO_LIBPCAP) +uninstall-dev: + rm -rf $(STAGING_DIR)/usr/include/pcap* + rm -rf $(STAGING_DIR)/usr/lib/libpcap.{a,so*} -clean: - -$(MAKE) -C $(PKG_BUILD_DIR) \ - DESTDIR="$(STAGING_DIR)" \ - uninstall - rm -rf $(PKG_BUILD_DIR) $(IPKG_LIBPCAP) +compile: install-dev +clean: uninstall-dev -- cgit v1.2.3 From 40f92c0d2a09ed23a6ce5bd40ff2ef637df73e8d Mon Sep 17 00:00:00 2001 From: nico Date: Fri, 13 May 2005 04:27:26 +0000 Subject: Fix typo git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@875 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 89f975344..bedebf2c7 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -73,8 +73,9 @@ $(IPKG_LIBPCAP): $(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built mkdir -p $(STAGING_DIR)/usr/include cp -fpR $(PKG_INSTALL_DIR)/usr/include/pcap* $(STAGING_DIR)/usr/include/ - mkdir -p $(I_LIBPCAP_DEV)/usr/lib + mkdir -p $(STAGING_DIR)/usr/lib cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(STAGING_DIR)/usr/lib/ + touch $(STAGING_DIR)/usr/lib/libpcap.so install-dev: $(STAGING_DIR)/usr/lib/libpcap.so -- cgit v1.2.3 From 0cfd99d729c2d53031c2d564a4b70760eb1a7c30 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 19 May 2005 16:49:23 +0000 Subject: Standardize package Config.in, change prompt to package name + short description, add URL when missing (and found) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@956 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Config.in b/package/libpcap/Config.in index 4f97c3ecd..0b3f441d8 100644 --- a/package/libpcap/Config.in +++ b/package/libpcap/Config.in @@ -1,5 +1,5 @@ config BR2_PACKAGE_LIBPCAP - tristate "libpcap (a low-level packet capture library)" + tristate "libpcap - Low-level packet capture library" default m if CONFIG_DEVEL help A system-independent library for user-level network packet capture. -- cgit v1.2.3 From d2368294409098f0d160f5cf432c149aa3bd858f Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 19 May 2005 21:14:18 +0000 Subject: Tweak package build git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@968 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index bedebf2c7..908c364a1 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -7,9 +7,7 @@ PKG_VERSION:=0.8.3 PKG_RELEASE:=1 PKG_MD5SUM:=56a9d4615d8354fcfe8cff8c8443c77b -PKG_SOURCE_URL:= \ - http://www.tcpdump.org/release \ - http://nthill.free.fr/openwrt/sources/$(PKG_NAME)/ +PKG_SOURCE_URL:=http://www.tcpdump.org/release/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_CAT:=zcat @@ -53,16 +51,16 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared --with-build-cc=$(HOSTCC) \ --with-pcap=linux \ ); - touch $(PKG_BUILD_DIR)/.configured + touch $@ $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured - $(MAKE) -C $(PKG_BUILD_DIR) \ - CCOPT="$(TARGET_CFLAGS)" + rm -rf $(PKG_INSTALL_DIR) mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) \ + CCOPT="$(TARGET_CFLAGS)" \ DESTDIR="$(PKG_INSTALL_DIR)" \ - install - touch $(PKG_BUILD_DIR)/.built + all install + touch $@ $(IPKG_LIBPCAP): install -m0755 -d $(IDIR_LIBPCAP)/usr/lib -- cgit v1.2.3 From 7c673c3d2664cc0d6e240c81c1ad6f3bb17f7a10 Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 21 Oct 2005 17:21:28 +0000 Subject: remove Maintainer: and Source: from packages git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2210 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/ipkg/libpcap.control | 4 ---- 1 file changed, 4 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/ipkg/libpcap.control b/package/libpcap/ipkg/libpcap.control index 4251be809..a743ea4fc 100644 --- a/package/libpcap/ipkg/libpcap.control +++ b/package/libpcap/ipkg/libpcap.control @@ -1,8 +1,4 @@ Package: libpcap Priority: optional Section: libs -Version: [TBDL] -Architecture: [TBDL] -Maintainer: Nico -Source: http://nthill.free.fr/openwrt/sources/libpcap/ Description: a low-level packet capture library -- cgit v1.2.3 From 6b53157103d462f7ea0b81f9fe77412719ea2260 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 22 Oct 2005 12:12:59 +0000 Subject: lots of small package changes and dependency cleanups for the V= stuff git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2230 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 908c364a1..fa79e7461 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -18,7 +18,7 @@ include $(TOPDIR)/package/rules.mk $(eval $(call PKG_template,LIBPCAP,libpcap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) -$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared +$(PKG_BUILD_DIR)/.configured: (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS)" \ @@ -53,7 +53,7 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared ); touch $@ -$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured +$(PKG_BUILD_DIR)/.built: rm -rf $(PKG_INSTALL_DIR) mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) \ @@ -81,5 +81,5 @@ uninstall-dev: rm -rf $(STAGING_DIR)/usr/include/pcap* rm -rf $(STAGING_DIR)/usr/lib/libpcap.{a,so*} -compile: install-dev -clean: uninstall-dev +compile-targets: install-dev +clean-targets: uninstall-dev -- cgit v1.2.3 From 30bf34f05c0f66d9d9221f7ebfe9808024337dd4 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 22 Oct 2005 22:03:56 +0000 Subject: add pf_ring patches for kernel and libpcap git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2266 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- package/libpcap/patches/110-pf_ring.patch | 613 ++++++++++++++++++++++++++++++ 2 files changed, 614 insertions(+), 1 deletion(-) create mode 100644 package/libpcap/patches/110-pf_ring.patch (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index fa79e7461..c7dfd9991 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -57,7 +57,7 @@ $(PKG_BUILD_DIR)/.built: rm -rf $(PKG_INSTALL_DIR) mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) \ - CCOPT="$(TARGET_CFLAGS)" \ + CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \ DESTDIR="$(PKG_INSTALL_DIR)" \ all install touch $@ diff --git a/package/libpcap/patches/110-pf_ring.patch b/package/libpcap/patches/110-pf_ring.patch new file mode 100644 index 000000000..1d5124fac --- /dev/null +++ b/package/libpcap/patches/110-pf_ring.patch @@ -0,0 +1,613 @@ +diff -urN libpcap.old/pcap-int.h libpcap.dev/pcap-int.h +--- libpcap.old/pcap-int.h 2003-12-15 02:42:24.000000000 +0100 ++++ libpcap.dev/pcap-int.h 2005-10-22 23:20:12.220060500 +0200 +@@ -30,7 +30,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.55.2.4 2003/12/15 01:42:24 guy Exp $ (LBL) ++ * @(#) $Header: /export/home/ntop/PF_RING/userland/libpcap-0.8.1-ring/pcap-int.h,v 1.2 2004/11/25 09:58:00 deri Exp $ (LBL) + */ + + #ifndef pcap_int_h +@@ -46,6 +46,8 @@ + #include + #endif /* WIN32 */ + ++#define RING /* L.Deri */ ++ + /* + * Savefile + */ +@@ -93,6 +95,57 @@ + #endif + }; + ++/* **************************** */ ++ ++#ifdef RING ++ ++#include ++#include ++#include ++#include ++ ++#define PAGE_SIZE 4096 ++ ++#define HAVE_PCAP ++#include ++#endif ++ ++#ifdef RING ++ ++#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ ++ ++struct e1000_rx_desc { ++ u_int64_t buffer_addr; /* Address of the descriptor's data buffer */ ++ u_int16_t length; /* Length of data DMAed into data buffer */ ++ u_int16_t csum; /* Packet checksum */ ++ u_int8_t status; /* Descriptor status */ ++ u_int8_t errors; /* Descriptor Errors */ ++ u_int16_t special; ++}; ++ ++/* Transmit Descriptor */ ++struct e1000_tx_desc { ++ u_int64_t buffer_addr; /* Address of the descriptor's data buffer */ ++ union { ++ u_int32_t data; ++ struct { ++ u_int16_t length; /* Data buffer length */ ++ u_int8_t cso; /* Checksum offset */ ++ u_int8_t cmd; /* Descriptor control */ ++ } flags; ++ } lower; ++ union { ++ u_int32_t data; ++ struct { ++ u_int8_t status; /* Descriptor status */ ++ u_int8_t css; /* Checksum start */ ++ u_int16_t special; ++ } fields; ++ } upper; ++}; ++ ++#endif ++ + struct pcap { + #ifdef WIN32 + ADAPTER *adapter; +@@ -121,6 +174,14 @@ + u_char *bp; + int cc; + ++#ifdef RING ++ /* PF_RING */ ++ char *ring_buffer, *ring_slots; ++ int ring_fd; ++ FlowSlotInfo *slots_info; ++ u_int page_id, slot_id, pkts_per_page; ++ u_int poll_sleep; ++#endif + /* + * Place holder for pcap_next(). + */ +diff -urN libpcap.old/pcap-linux.c libpcap.dev/pcap-linux.c +--- libpcap.old/pcap-linux.c 2003-11-21 11:20:46.000000000 +0100 ++++ libpcap.dev/pcap-linux.c 2005-10-22 23:43:59.726120250 +0200 +@@ -27,7 +27,7 @@ + + #ifndef lint + static const char rcsid[] _U_ = +- "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.98.2.4 2003/11/21 10:20:46 guy Exp $ (LBL)"; ++ "@(#) $Header: /export/home/ntop/PF_RING/userland/libpcap-0.8.1-ring/pcap-linux.c,v 1.2 2004/11/25 09:58:00 deri Exp $ (LBL)"; + #endif + + /* +@@ -83,7 +83,7 @@ + #ifdef HAVE_DAG_API + #include "pcap-dag.h" + #endif /* HAVE_DAG_API */ +- ++ + #include + #include + #include +@@ -217,6 +217,83 @@ + = { 1, &total_insn }; + #endif + ++#define RING /* L.Deri */ ++#define SAFE_RING_MODE /* ++ Copy the bucket in order to avoid kernel ++ crash if the application faults ++ */ ++ ++#ifdef RING ++unsigned char *write_register; ++static struct pcap_stat ringStats; ++u_long numPollCalls = 0, numReadCalls = 0; ++ ++#define POLL_SLEEP_STEP 10 /* ns = 0.1 ms */ ++#define POLL_SLEEP_MIN POLL_SLEEP_STEP ++#define POLL_SLEEP_MAX 1000 /* ns */ ++#define POLL_QUEUE_MIN_LEN 500 /* # packets */ ++ ++#ifdef SAFE_RING_MODE ++static char staticBucket[2048]; ++#endif ++ ++ ++/* ******************************* */ ++ ++int pcap_set_cluster(pcap_t *handle, u_int clusterId) { ++ return(handle->ring_fd ? setsockopt(handle->ring_fd, 0, SO_ADD_TO_CLUSTER, ++ &clusterId, sizeof(clusterId)): -1); ++} ++ ++/* ******************************* */ ++ ++int pcap_remove_from_cluster(pcap_t *handle) { ++ return(handle->ring_fd ? ++ setsockopt(handle->ring_fd, 0, SO_REMOVE_FROM_CLUSTER, NULL, 0) : -1); ++} ++ ++/* ******************************* */ ++ ++int pcap_set_reflector(pcap_t *handle, char *reflectorDevice) { ++ return(handle->ring_fd ? ++ setsockopt(handle->ring_fd, 0, SO_SET_REFLECTOR, ++ &reflectorDevice, strlen(reflectorDevice)) : -1); ++} ++ ++/* ******************************* */ ++ ++static int set_if_promisc(const char *device, int set_promisc) { ++ int sock_fd; ++ struct ifreq ifr; ++ ++ if(device == NULL) return(-3); ++ ++ sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); ++ if(sock_fd <= 0) return(-1); ++ ++ memset(&ifr, 0, sizeof(ifr)); ++ strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); ++ if(ioctl(sock_fd, SIOCGIFFLAGS, &ifr) == -1) { ++ close(sock_fd); ++ return(-2); ++ } ++ ++ if(set_promisc) { ++ if((ifr.ifr_flags & IFF_PROMISC) == 0) ifr.ifr_flags |= IFF_PROMISC; ++ } else { ++ /* Remove promisc */ ++ if((ifr.ifr_flags & IFF_PROMISC) != 0) ifr.ifr_flags &= ~IFF_PROMISC; ++ } ++ ++ if(ioctl(sock_fd, SIOCSIFFLAGS, &ifr) == -1) ++ return(-1); ++ ++ close(sock_fd); ++ return(0); ++} ++ ++#endif ++ + /* + * Get a handle for a live capture from the given device. You can + * pass NULL as device to get all packages (without link level +@@ -258,6 +335,138 @@ + handle->snapshot = snaplen; + handle->md.timeout = to_ms; + ++#ifdef RING ++ handle->ring_fd = handle->fd = socket(PF_RING, SOCK_RAW, htons(ETH_P_ALL)); ++ ++ printf("Open RING [fd=%d]\n", handle->ring_fd); ++ ++ if(handle->ring_fd > 0) { ++ struct sockaddr sa; ++ int rc; ++ u_int memSlotsLen; ++ ++ err = 0; ++ sa.sa_family = PF_RING; ++ snprintf(sa.sa_data, sizeof(sa.sa_data), "%s", device); ++ rc = bind(handle->ring_fd, (struct sockaddr *)&sa, sizeof(sa)); ++ ++ if(rc == 0) { ++ ++ ++ handle->md.device = strdup(device); ++ handle->ring_buffer = (char *)mmap(NULL, PAGE_SIZE, ++ PROT_READ|PROT_WRITE, ++ MAP_SHARED, ++ handle->ring_fd, 0); ++ ++ if(handle->ring_buffer == MAP_FAILED) { ++ sprintf(ebuf, "mmap() failed"); ++ return (NULL); ++ } ++ ++ handle->slots_info = (FlowSlotInfo *)handle->ring_buffer; ++ if(handle->slots_info->version != RING_FLOWSLOT_VERSION) { ++ snprintf(ebuf, PCAP_ERRBUF_SIZE, "Wrong RING version: " ++ "kernel is %i, libpcap was compiled with %i\n", ++ handle->slots_info->version, RING_FLOWSLOT_VERSION); ++ return (NULL); ++ } ++ memSlotsLen = handle->slots_info->tot_mem; ++ munmap(handle->ring_buffer, PAGE_SIZE); ++ ++ handle->ring_buffer = (char *)mmap(NULL, memSlotsLen, ++ PROT_READ|PROT_WRITE, ++ MAP_SHARED, handle->ring_fd, 0); ++ ++ if(handle->ring_buffer == MAP_FAILED) { ++ sprintf(ebuf, "mmap() failed"); ++ return (NULL); ++ } ++ ++ handle->slots_info = (FlowSlotInfo *)handle->ring_buffer; ++ handle->ring_slots = (char *)(handle->ring_buffer+sizeof(FlowSlotInfo)); ++ ++ /* Safety check */ ++ if(handle->slots_info->remove_idx >= handle->slots_info->tot_slots) ++ handle->slots_info->remove_idx = 0; ++ ++ handle->page_id = PAGE_SIZE, handle->slot_id = 0, ++ handle->pkts_per_page = 0; ++ ++ if(0) { ++ int i; ++ ++ for(i=0; islots_info->tot_slots; i++) { ++ unsigned long idx = i*handle->slots_info->slot_len; ++ FlowSlot *slot = (FlowSlot*)&handle->ring_slots[idx]; ++ ++ printf("RING: Setting RING_MAGIC_VALUE into slot %d [displacement=%lu]\n", i, idx); ++ slot->magic = RING_MAGIC_VALUE; slot->slot_state = 0; ++ printf("RING: slot[%d]: magic=%d, slot_state=%d\n", ++ slot->magic, slot->slot_state); ++ } ++ } ++ ++ ++ /* Set defaults */ ++ handle->linktype = DLT_EN10MB; ++ handle->offset = 2; ++ ++ printf("RING (%s): tot_slots=%d/slot_len=%d/" ++ "insertIdx=%d/remove_idx=%d/dropped=%d\n", ++ device, ++ handle->slots_info->tot_slots, ++ handle->slots_info->slot_len, ++ handle->slots_info->insert_idx, ++ handle->slots_info->remove_idx, ++ handle->slots_info->tot_lost); ++ ++ ringStats.ps_recv = handle->slots_info->tot_read; ++ ringStats.ps_drop = handle->slots_info->tot_lost; ++ ++ if(promisc) { ++ struct ifreq ifr; ++ ++ err = 0; ++ memset(&ifr, 0, sizeof(ifr)); ++ strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); ++ if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) { ++ snprintf(ebuf, PCAP_ERRBUF_SIZE, ++ "ioctl: %s", pcap_strerror(errno)); ++ err = 1; ++ } ++ ++ if(err == 0) { ++ if ((ifr.ifr_flags & IFF_PROMISC) == 0) { ++ /* ++ * Promiscuous mode isn't currently on, ++ * so turn it on, and remember that ++ * we should turn it off when the ++ * pcap_t is closed. ++ */ ++ ++ ifr.ifr_flags |= IFF_PROMISC; ++ if (ioctl(handle->fd, SIOCSIFFLAGS, &ifr) == -1) { ++ snprintf(ebuf, PCAP_ERRBUF_SIZE, ++ "ioctl: %s", pcap_strerror(errno)); ++ err = 1; ++ } ++ } ++ ++ if(err == 0) ++ handle->md.clear_promisc = 1; ++ } ++ } ++ ++ if(err == 0) ++ goto open_open_live_final; ++ } ++ ++ /* Don't put 'else' above... */ ++ close(handle->ring_fd); ++ /* Continue without ring support */ ++ } ++#endif + /* + * NULL and "any" are special devices which give us the hint to + * monitor all devices. +@@ -397,6 +606,9 @@ + return NULL; + } + ++#ifdef RING ++ open_open_live_final: ++#endif + /* + * "handle->fd" is a socket, so "select()" and "poll()" + * should work on it. +@@ -449,6 +661,120 @@ + int packet_len, caplen; + struct pcap_pkthdr pcap_header; + ++#ifdef RING ++ if(handle->ring_buffer != NULL) { ++ u_int idx, numRuns = 0, ptrAddr; ++ FlowSlot *slot; ++ ++ slot = (FlowSlot*)&handle->ring_slots[handle->slots_info->remove_idx*handle->slots_info->slot_len]; ++ ++ while(1) { ++ u_int32_t queuedPkts; ++ ++ if(handle->slots_info->tot_insert >= handle->slots_info->tot_read) ++ queuedPkts = handle->slots_info->tot_insert - handle->slots_info->tot_read; ++ else ++ queuedPkts = handle->slots_info->tot_slots + handle->slots_info->tot_insert - handle->slots_info->tot_read; ++ ++ if(queuedPkts && (slot->slot_state == 1)) { ++ char *bucket = &slot->bucket; ++ ++#ifdef RING_MAGIC ++ if(slot->magic != RING_MAGIC_VALUE) { ++ printf("==>> Bad Magic [remove_idx=%u][insert_idx=%u][ptrAddr=%u]\n", ++ handle->slots_info->remove_idx, ++ handle->slots_info->insert_idx, ++ ptrAddr); ++ slot->magic = RING_MAGIC_VALUE; ++ } ++#endif ++ ++ ++ handle->md.stat.ps_recv++; ++ ++#ifdef SAFE_RING_MODE ++ { ++ struct pcap_pkthdr *hdr = (struct pcap_pkthdr*)bucket; ++ int bktLen = hdr->caplen; ++ ++ if(bktLen > sizeof(staticBucket)) ++ bktLen = sizeof(staticBucket); ++ ++ memcpy(staticBucket, &bucket[sizeof(struct pcap_pkthdr)], bktLen); ++ ++#ifdef RING_DEBUG ++ printf("==>> [remove_idx=%u][insert_idx=%u][ptrAddr=%u]\n", ++ handle->slots_info->remove_idx, ++ handle->slots_info->insert_idx, ++ ptrAddr); ++#endif ++ ++ callback(userdata, hdr, staticBucket); ++ } ++#else ++ callback(userdata, ++ (const struct pcap_pkthdr*)bucket, ++ (const u_char*)&bucket[sizeof(struct pcap_pkthdr)]); ++#endif ++ ++ if(handle->slots_info->remove_idx >= (handle->slots_info->tot_slots-1)) { ++ handle->slots_info->remove_idx = 0; ++ handle->page_id = PAGE_SIZE, handle->slot_id = 0, handle->pkts_per_page = 0; ++ } else { ++ handle->slots_info->remove_idx++; ++ handle->pkts_per_page++, handle->slot_id += handle->slots_info->slot_len; ++ } ++ ++ handle->slots_info->tot_read++; ++ slot->slot_state = 0; ++ ++ return(1); ++ } else { ++ struct pollfd pfd; ++ int rc; ++ ++ /* Sleep when nothing is happening */ ++ pfd.fd = handle->ring_fd; ++ pfd.events = POLLIN|POLLERR; ++ pfd.revents = 0; ++ ++#ifdef RING_DEBUG ++ printf("==>> poll [remove_idx=%u][insert_idx=%u][loss=%d][queuedPkts=%u]" ++ "[slot_state=%d][tot_insert=%u][tot_read=%u]\n", ++ handle->slots_info->remove_idx, ++ handle->slots_info->insert_idx, ++ handle->slots_info->tot_lost, ++ queuedPkts, slot->slot_state, ++ handle->slots_info->tot_insert, ++ handle->slots_info->tot_read); ++ #endif ++ ++#ifdef RING_DEBUG ++ printf("==>> poll @ [remove_idx=%u][slot_id=%u]\n", handle->slots_info->remove_idx, handle->slot_id); ++#endif ++ errno = 0; ++ rc = poll(&pfd, 1, -1); ++#ifdef RING_DEBUG ++ printf("==>> poll returned %d [%s][errno=%d][break_loop=%d]\n", ++ rc, strerror(errno), errno, handle->break_loop); ++#endif ++ numPollCalls++; ++ ++ if(rc == -1) { ++ if(errno == EINTR) { ++ if(handle->break_loop) { ++ handle->break_loop = 0; ++ return(-2); ++ } else ++ return(0); ++ } else ++ return(-1); ++ } ++ } ++ } /* while() */ ++ } ++#endif ++ + #ifdef HAVE_PF_PACKET_SOCKETS + /* + * If this is a cooked device, leave extra room for a +@@ -688,6 +1014,22 @@ + socklen_t len = sizeof (struct tpacket_stats); + #endif + ++#ifdef RING ++ if(handle->ring_fd > 0) { ++ stats->ps_recv = handle->slots_info->tot_read-ringStats.ps_recv; ++ stats->ps_drop = handle->slots_info->tot_lost-ringStats.ps_drop; ++ ++ printf("RING: numPollCalls=%d [%.1f packets/call]\n", ++ numPollCalls, (float)stats->ps_recv/(float)numPollCalls); ++ printf("RING: [tot_pkts=%u][tot_read=%u][tot_lost=%u]\n", ++ handle->slots_info->tot_pkts, ++ handle->slots_info->tot_read, ++ handle->slots_info->tot_lost); ++ ++ return(0); ++ } ++#endif ++ + #ifdef HAVE_TPACKET_STATS + /* + * Try to get the packet counts from the kernel. +@@ -879,6 +1221,11 @@ + } + } + ++ ++#ifdef RING ++ if(handle->ring_fd <= 0) can_filter_in_kernel = 0; ++#endif ++ + if (can_filter_in_kernel) { + if ((err = set_kernel_filter(handle, &fcode)) == 0) + { +@@ -1348,7 +1695,7 @@ + memset(&mr, 0, sizeof(mr)); + mr.mr_ifindex = device_id; + mr.mr_type = PACKET_MR_PROMISC; +- if (setsockopt(sock_fd, SOL_PACKET, ++ if (setsockopt(sock_fd, 0 /* SOL_PACKET */, + PACKET_ADD_MEMBERSHIP, &mr, sizeof(mr)) == -1) + { + snprintf(ebuf, PCAP_ERRBUF_SIZE, +@@ -1425,10 +1772,11 @@ + + /* Any pending errors, e.g., network is down? */ + +- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) { +- snprintf(ebuf, PCAP_ERRBUF_SIZE, +- "getsockopt: %s", pcap_strerror(errno)); +- return -2; ++ if ((getsockopt(fd, PF_RING, SO_ERROR, &err, &errlen) == -1) ++ && (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1)) { ++ snprintf(ebuf, PCAP_ERRBUF_SIZE, ++ "getsockopt: %s", pcap_strerror(errno)); ++ return -2; + } + + if (err > 0) { +@@ -1482,6 +1830,13 @@ + struct pcap *p, *prevp; + struct ifreq ifr; + ++#ifdef RING ++ if(handle->ring_buffer != NULL) { ++ munmap(handle->ring_buffer, handle->slots_info->tot_mem); ++ handle->ring_buffer = NULL; ++ } ++#endif ++ + if (handle->md.clear_promisc) { + /* + * We put the interface into promiscuous mode; take +@@ -1698,11 +2053,11 @@ + } + + /* Any pending errors, e.g., network is down? */ +- +- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) { +- snprintf(ebuf, PCAP_ERRBUF_SIZE, +- "getsockopt: %s", pcap_strerror(errno)); +- return -1; ++ if((getsockopt(fd, PF_RING, SO_ERROR, &err, &errlen) == -1) ++ && (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1)) { ++ snprintf(ebuf, PCAP_ERRBUF_SIZE, ++ "getsockopt: %s", pcap_strerror(errno)); ++ return -1; + } + + if (err > 0) { +@@ -1924,8 +2279,11 @@ + * the filtering done in userland even if it could have been + * done in the kernel. + */ +- if (setsockopt(handle->fd, SOL_SOCKET, SO_ATTACH_FILTER, +- &total_fcode, sizeof(total_fcode)) == 0) { ++ printf("pcap[setsockopt(%d)]\n", 0); ++ if (setsockopt(handle->fd, 0 /* SOL_SOCKET */, ++ SO_ATTACH_FILTER, ++ &total_fcode, ++ sizeof(total_fcode)) == 0) { + char drain[1]; + + /* +@@ -1933,6 +2291,9 @@ + */ + total_filter_on = 1; + ++#ifdef RING ++ if(!handle->ring_fd) { ++#endif + /* + * Save the socket's current mode, and put it in + * non-blocking mode; we drain it by reading packets +@@ -1955,12 +2316,15 @@ + return -2; + } + } +- } ++#ifdef RING ++ } ++#endif ++} + + /* + * Now attach the new filter. + */ +- ret = setsockopt(handle->fd, SOL_SOCKET, SO_ATTACH_FILTER, ++ ret = setsockopt(handle->fd, 0 /* SOL_SOCKET */, SO_ATTACH_FILTER, + fcode, sizeof(*fcode)); + if (ret == -1 && total_filter_on) { + /* +@@ -1993,7 +2357,8 @@ + /* setsockopt() barfs unless it get a dummy parameter */ + int dummy; + +- return setsockopt(handle->fd, SOL_SOCKET, SO_DETACH_FILTER, +- &dummy, sizeof(dummy)); ++ return setsockopt(handle->fd, handle->ring_fd > 0 ? PF_RING : SOL_SOCKET, ++ SO_DETACH_FILTER, ++ &dummy, sizeof(dummy)); + } + #endif -- cgit v1.2.3 From 7bd944d2153b871aaaee970811f27772cbe36a6f Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 5 Nov 2005 02:16:36 +0000 Subject: reorganize/rationalize/format package menuconfig, make updatedd modular git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2333 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Config.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Config.in b/package/libpcap/Config.in index 0b3f441d8..d2075647e 100644 --- a/package/libpcap/Config.in +++ b/package/libpcap/Config.in @@ -1,7 +1,9 @@ config BR2_PACKAGE_LIBPCAP - tristate "libpcap - Low-level packet capture library" + prompt "libpcap........................... Low-level packet capture library" + tristate default m if CONFIG_DEVEL help A system-independent library for user-level network packet capture. - + http://www.tcpdump.org/ + -- cgit v1.2.3 From 0afac1c419d6e9c2f0878eb736a6de186f229fa5 Mon Sep 17 00:00:00 2001 From: wbx Date: Sun, 25 Dec 2005 04:28:19 +0000 Subject: enable ipv6, closes #129, bump release number git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2773 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index c7dfd9991..42bac4690 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap PKG_VERSION:=0.8.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=56a9d4615d8354fcfe8cff8c8443c77b PKG_SOURCE_URL:=http://www.tcpdump.org/release/ @@ -48,6 +48,7 @@ $(PKG_BUILD_DIR)/.configured: --enable-shared \ --enable-static \ --disable-yydebug \ + --enable-ipv6 \ --with-build-cc=$(HOSTCC) \ --with-pcap=linux \ ); -- cgit v1.2.3 From cf0fd68d791ce252e29be3f1aa7aa88e42979249 Mon Sep 17 00:00:00 2001 From: wbx Date: Tue, 31 Jan 2006 17:12:10 +0000 Subject: remove pfring support git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3096 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/patches/110-pf_ring.patch | 613 ------------------------------ 1 file changed, 613 deletions(-) delete mode 100644 package/libpcap/patches/110-pf_ring.patch (limited to 'package/libpcap') diff --git a/package/libpcap/patches/110-pf_ring.patch b/package/libpcap/patches/110-pf_ring.patch deleted file mode 100644 index 1d5124fac..000000000 --- a/package/libpcap/patches/110-pf_ring.patch +++ /dev/null @@ -1,613 +0,0 @@ -diff -urN libpcap.old/pcap-int.h libpcap.dev/pcap-int.h ---- libpcap.old/pcap-int.h 2003-12-15 02:42:24.000000000 +0100 -+++ libpcap.dev/pcap-int.h 2005-10-22 23:20:12.220060500 +0200 -@@ -30,7 +30,7 @@ - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * -- * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.55.2.4 2003/12/15 01:42:24 guy Exp $ (LBL) -+ * @(#) $Header: /export/home/ntop/PF_RING/userland/libpcap-0.8.1-ring/pcap-int.h,v 1.2 2004/11/25 09:58:00 deri Exp $ (LBL) - */ - - #ifndef pcap_int_h -@@ -46,6 +46,8 @@ - #include - #endif /* WIN32 */ - -+#define RING /* L.Deri */ -+ - /* - * Savefile - */ -@@ -93,6 +95,57 @@ - #endif - }; - -+/* **************************** */ -+ -+#ifdef RING -+ -+#include -+#include -+#include -+#include -+ -+#define PAGE_SIZE 4096 -+ -+#define HAVE_PCAP -+#include -+#endif -+ -+#ifdef RING -+ -+#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ -+ -+struct e1000_rx_desc { -+ u_int64_t buffer_addr; /* Address of the descriptor's data buffer */ -+ u_int16_t length; /* Length of data DMAed into data buffer */ -+ u_int16_t csum; /* Packet checksum */ -+ u_int8_t status; /* Descriptor status */ -+ u_int8_t errors; /* Descriptor Errors */ -+ u_int16_t special; -+}; -+ -+/* Transmit Descriptor */ -+struct e1000_tx_desc { -+ u_int64_t buffer_addr; /* Address of the descriptor's data buffer */ -+ union { -+ u_int32_t data; -+ struct { -+ u_int16_t length; /* Data buffer length */ -+ u_int8_t cso; /* Checksum offset */ -+ u_int8_t cmd; /* Descriptor control */ -+ } flags; -+ } lower; -+ union { -+ u_int32_t data; -+ struct { -+ u_int8_t status; /* Descriptor status */ -+ u_int8_t css; /* Checksum start */ -+ u_int16_t special; -+ } fields; -+ } upper; -+}; -+ -+#endif -+ - struct pcap { - #ifdef WIN32 - ADAPTER *adapter; -@@ -121,6 +174,14 @@ - u_char *bp; - int cc; - -+#ifdef RING -+ /* PF_RING */ -+ char *ring_buffer, *ring_slots; -+ int ring_fd; -+ FlowSlotInfo *slots_info; -+ u_int page_id, slot_id, pkts_per_page; -+ u_int poll_sleep; -+#endif - /* - * Place holder for pcap_next(). - */ -diff -urN libpcap.old/pcap-linux.c libpcap.dev/pcap-linux.c ---- libpcap.old/pcap-linux.c 2003-11-21 11:20:46.000000000 +0100 -+++ libpcap.dev/pcap-linux.c 2005-10-22 23:43:59.726120250 +0200 -@@ -27,7 +27,7 @@ - - #ifndef lint - static const char rcsid[] _U_ = -- "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.98.2.4 2003/11/21 10:20:46 guy Exp $ (LBL)"; -+ "@(#) $Header: /export/home/ntop/PF_RING/userland/libpcap-0.8.1-ring/pcap-linux.c,v 1.2 2004/11/25 09:58:00 deri Exp $ (LBL)"; - #endif - - /* -@@ -83,7 +83,7 @@ - #ifdef HAVE_DAG_API - #include "pcap-dag.h" - #endif /* HAVE_DAG_API */ -- -+ - #include - #include - #include -@@ -217,6 +217,83 @@ - = { 1, &total_insn }; - #endif - -+#define RING /* L.Deri */ -+#define SAFE_RING_MODE /* -+ Copy the bucket in order to avoid kernel -+ crash if the application faults -+ */ -+ -+#ifdef RING -+unsigned char *write_register; -+static struct pcap_stat ringStats; -+u_long numPollCalls = 0, numReadCalls = 0; -+ -+#define POLL_SLEEP_STEP 10 /* ns = 0.1 ms */ -+#define POLL_SLEEP_MIN POLL_SLEEP_STEP -+#define POLL_SLEEP_MAX 1000 /* ns */ -+#define POLL_QUEUE_MIN_LEN 500 /* # packets */ -+ -+#ifdef SAFE_RING_MODE -+static char staticBucket[2048]; -+#endif -+ -+ -+/* ******************************* */ -+ -+int pcap_set_cluster(pcap_t *handle, u_int clusterId) { -+ return(handle->ring_fd ? setsockopt(handle->ring_fd, 0, SO_ADD_TO_CLUSTER, -+ &clusterId, sizeof(clusterId)): -1); -+} -+ -+/* ******************************* */ -+ -+int pcap_remove_from_cluster(pcap_t *handle) { -+ return(handle->ring_fd ? -+ setsockopt(handle->ring_fd, 0, SO_REMOVE_FROM_CLUSTER, NULL, 0) : -1); -+} -+ -+/* ******************************* */ -+ -+int pcap_set_reflector(pcap_t *handle, char *reflectorDevice) { -+ return(handle->ring_fd ? -+ setsockopt(handle->ring_fd, 0, SO_SET_REFLECTOR, -+ &reflectorDevice, strlen(reflectorDevice)) : -1); -+} -+ -+/* ******************************* */ -+ -+static int set_if_promisc(const char *device, int set_promisc) { -+ int sock_fd; -+ struct ifreq ifr; -+ -+ if(device == NULL) return(-3); -+ -+ sock_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); -+ if(sock_fd <= 0) return(-1); -+ -+ memset(&ifr, 0, sizeof(ifr)); -+ strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); -+ if(ioctl(sock_fd, SIOCGIFFLAGS, &ifr) == -1) { -+ close(sock_fd); -+ return(-2); -+ } -+ -+ if(set_promisc) { -+ if((ifr.ifr_flags & IFF_PROMISC) == 0) ifr.ifr_flags |= IFF_PROMISC; -+ } else { -+ /* Remove promisc */ -+ if((ifr.ifr_flags & IFF_PROMISC) != 0) ifr.ifr_flags &= ~IFF_PROMISC; -+ } -+ -+ if(ioctl(sock_fd, SIOCSIFFLAGS, &ifr) == -1) -+ return(-1); -+ -+ close(sock_fd); -+ return(0); -+} -+ -+#endif -+ - /* - * Get a handle for a live capture from the given device. You can - * pass NULL as device to get all packages (without link level -@@ -258,6 +335,138 @@ - handle->snapshot = snaplen; - handle->md.timeout = to_ms; - -+#ifdef RING -+ handle->ring_fd = handle->fd = socket(PF_RING, SOCK_RAW, htons(ETH_P_ALL)); -+ -+ printf("Open RING [fd=%d]\n", handle->ring_fd); -+ -+ if(handle->ring_fd > 0) { -+ struct sockaddr sa; -+ int rc; -+ u_int memSlotsLen; -+ -+ err = 0; -+ sa.sa_family = PF_RING; -+ snprintf(sa.sa_data, sizeof(sa.sa_data), "%s", device); -+ rc = bind(handle->ring_fd, (struct sockaddr *)&sa, sizeof(sa)); -+ -+ if(rc == 0) { -+ -+ -+ handle->md.device = strdup(device); -+ handle->ring_buffer = (char *)mmap(NULL, PAGE_SIZE, -+ PROT_READ|PROT_WRITE, -+ MAP_SHARED, -+ handle->ring_fd, 0); -+ -+ if(handle->ring_buffer == MAP_FAILED) { -+ sprintf(ebuf, "mmap() failed"); -+ return (NULL); -+ } -+ -+ handle->slots_info = (FlowSlotInfo *)handle->ring_buffer; -+ if(handle->slots_info->version != RING_FLOWSLOT_VERSION) { -+ snprintf(ebuf, PCAP_ERRBUF_SIZE, "Wrong RING version: " -+ "kernel is %i, libpcap was compiled with %i\n", -+ handle->slots_info->version, RING_FLOWSLOT_VERSION); -+ return (NULL); -+ } -+ memSlotsLen = handle->slots_info->tot_mem; -+ munmap(handle->ring_buffer, PAGE_SIZE); -+ -+ handle->ring_buffer = (char *)mmap(NULL, memSlotsLen, -+ PROT_READ|PROT_WRITE, -+ MAP_SHARED, handle->ring_fd, 0); -+ -+ if(handle->ring_buffer == MAP_FAILED) { -+ sprintf(ebuf, "mmap() failed"); -+ return (NULL); -+ } -+ -+ handle->slots_info = (FlowSlotInfo *)handle->ring_buffer; -+ handle->ring_slots = (char *)(handle->ring_buffer+sizeof(FlowSlotInfo)); -+ -+ /* Safety check */ -+ if(handle->slots_info->remove_idx >= handle->slots_info->tot_slots) -+ handle->slots_info->remove_idx = 0; -+ -+ handle->page_id = PAGE_SIZE, handle->slot_id = 0, -+ handle->pkts_per_page = 0; -+ -+ if(0) { -+ int i; -+ -+ for(i=0; islots_info->tot_slots; i++) { -+ unsigned long idx = i*handle->slots_info->slot_len; -+ FlowSlot *slot = (FlowSlot*)&handle->ring_slots[idx]; -+ -+ printf("RING: Setting RING_MAGIC_VALUE into slot %d [displacement=%lu]\n", i, idx); -+ slot->magic = RING_MAGIC_VALUE; slot->slot_state = 0; -+ printf("RING: slot[%d]: magic=%d, slot_state=%d\n", -+ slot->magic, slot->slot_state); -+ } -+ } -+ -+ -+ /* Set defaults */ -+ handle->linktype = DLT_EN10MB; -+ handle->offset = 2; -+ -+ printf("RING (%s): tot_slots=%d/slot_len=%d/" -+ "insertIdx=%d/remove_idx=%d/dropped=%d\n", -+ device, -+ handle->slots_info->tot_slots, -+ handle->slots_info->slot_len, -+ handle->slots_info->insert_idx, -+ handle->slots_info->remove_idx, -+ handle->slots_info->tot_lost); -+ -+ ringStats.ps_recv = handle->slots_info->tot_read; -+ ringStats.ps_drop = handle->slots_info->tot_lost; -+ -+ if(promisc) { -+ struct ifreq ifr; -+ -+ err = 0; -+ memset(&ifr, 0, sizeof(ifr)); -+ strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)); -+ if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) { -+ snprintf(ebuf, PCAP_ERRBUF_SIZE, -+ "ioctl: %s", pcap_strerror(errno)); -+ err = 1; -+ } -+ -+ if(err == 0) { -+ if ((ifr.ifr_flags & IFF_PROMISC) == 0) { -+ /* -+ * Promiscuous mode isn't currently on, -+ * so turn it on, and remember that -+ * we should turn it off when the -+ * pcap_t is closed. -+ */ -+ -+ ifr.ifr_flags |= IFF_PROMISC; -+ if (ioctl(handle->fd, SIOCSIFFLAGS, &ifr) == -1) { -+ snprintf(ebuf, PCAP_ERRBUF_SIZE, -+ "ioctl: %s", pcap_strerror(errno)); -+ err = 1; -+ } -+ } -+ -+ if(err == 0) -+ handle->md.clear_promisc = 1; -+ } -+ } -+ -+ if(err == 0) -+ goto open_open_live_final; -+ } -+ -+ /* Don't put 'else' above... */ -+ close(handle->ring_fd); -+ /* Continue without ring support */ -+ } -+#endif - /* - * NULL and "any" are special devices which give us the hint to - * monitor all devices. -@@ -397,6 +606,9 @@ - return NULL; - } - -+#ifdef RING -+ open_open_live_final: -+#endif - /* - * "handle->fd" is a socket, so "select()" and "poll()" - * should work on it. -@@ -449,6 +661,120 @@ - int packet_len, caplen; - struct pcap_pkthdr pcap_header; - -+#ifdef RING -+ if(handle->ring_buffer != NULL) { -+ u_int idx, numRuns = 0, ptrAddr; -+ FlowSlot *slot; -+ -+ slot = (FlowSlot*)&handle->ring_slots[handle->slots_info->remove_idx*handle->slots_info->slot_len]; -+ -+ while(1) { -+ u_int32_t queuedPkts; -+ -+ if(handle->slots_info->tot_insert >= handle->slots_info->tot_read) -+ queuedPkts = handle->slots_info->tot_insert - handle->slots_info->tot_read; -+ else -+ queuedPkts = handle->slots_info->tot_slots + handle->slots_info->tot_insert - handle->slots_info->tot_read; -+ -+ if(queuedPkts && (slot->slot_state == 1)) { -+ char *bucket = &slot->bucket; -+ -+#ifdef RING_MAGIC -+ if(slot->magic != RING_MAGIC_VALUE) { -+ printf("==>> Bad Magic [remove_idx=%u][insert_idx=%u][ptrAddr=%u]\n", -+ handle->slots_info->remove_idx, -+ handle->slots_info->insert_idx, -+ ptrAddr); -+ slot->magic = RING_MAGIC_VALUE; -+ } -+#endif -+ -+ -+ handle->md.stat.ps_recv++; -+ -+#ifdef SAFE_RING_MODE -+ { -+ struct pcap_pkthdr *hdr = (struct pcap_pkthdr*)bucket; -+ int bktLen = hdr->caplen; -+ -+ if(bktLen > sizeof(staticBucket)) -+ bktLen = sizeof(staticBucket); -+ -+ memcpy(staticBucket, &bucket[sizeof(struct pcap_pkthdr)], bktLen); -+ -+#ifdef RING_DEBUG -+ printf("==>> [remove_idx=%u][insert_idx=%u][ptrAddr=%u]\n", -+ handle->slots_info->remove_idx, -+ handle->slots_info->insert_idx, -+ ptrAddr); -+#endif -+ -+ callback(userdata, hdr, staticBucket); -+ } -+#else -+ callback(userdata, -+ (const struct pcap_pkthdr*)bucket, -+ (const u_char*)&bucket[sizeof(struct pcap_pkthdr)]); -+#endif -+ -+ if(handle->slots_info->remove_idx >= (handle->slots_info->tot_slots-1)) { -+ handle->slots_info->remove_idx = 0; -+ handle->page_id = PAGE_SIZE, handle->slot_id = 0, handle->pkts_per_page = 0; -+ } else { -+ handle->slots_info->remove_idx++; -+ handle->pkts_per_page++, handle->slot_id += handle->slots_info->slot_len; -+ } -+ -+ handle->slots_info->tot_read++; -+ slot->slot_state = 0; -+ -+ return(1); -+ } else { -+ struct pollfd pfd; -+ int rc; -+ -+ /* Sleep when nothing is happening */ -+ pfd.fd = handle->ring_fd; -+ pfd.events = POLLIN|POLLERR; -+ pfd.revents = 0; -+ -+#ifdef RING_DEBUG -+ printf("==>> poll [remove_idx=%u][insert_idx=%u][loss=%d][queuedPkts=%u]" -+ "[slot_state=%d][tot_insert=%u][tot_read=%u]\n", -+ handle->slots_info->remove_idx, -+ handle->slots_info->insert_idx, -+ handle->slots_info->tot_lost, -+ queuedPkts, slot->slot_state, -+ handle->slots_info->tot_insert, -+ handle->slots_info->tot_read); -+ #endif -+ -+#ifdef RING_DEBUG -+ printf("==>> poll @ [remove_idx=%u][slot_id=%u]\n", handle->slots_info->remove_idx, handle->slot_id); -+#endif -+ errno = 0; -+ rc = poll(&pfd, 1, -1); -+#ifdef RING_DEBUG -+ printf("==>> poll returned %d [%s][errno=%d][break_loop=%d]\n", -+ rc, strerror(errno), errno, handle->break_loop); -+#endif -+ numPollCalls++; -+ -+ if(rc == -1) { -+ if(errno == EINTR) { -+ if(handle->break_loop) { -+ handle->break_loop = 0; -+ return(-2); -+ } else -+ return(0); -+ } else -+ return(-1); -+ } -+ } -+ } /* while() */ -+ } -+#endif -+ - #ifdef HAVE_PF_PACKET_SOCKETS - /* - * If this is a cooked device, leave extra room for a -@@ -688,6 +1014,22 @@ - socklen_t len = sizeof (struct tpacket_stats); - #endif - -+#ifdef RING -+ if(handle->ring_fd > 0) { -+ stats->ps_recv = handle->slots_info->tot_read-ringStats.ps_recv; -+ stats->ps_drop = handle->slots_info->tot_lost-ringStats.ps_drop; -+ -+ printf("RING: numPollCalls=%d [%.1f packets/call]\n", -+ numPollCalls, (float)stats->ps_recv/(float)numPollCalls); -+ printf("RING: [tot_pkts=%u][tot_read=%u][tot_lost=%u]\n", -+ handle->slots_info->tot_pkts, -+ handle->slots_info->tot_read, -+ handle->slots_info->tot_lost); -+ -+ return(0); -+ } -+#endif -+ - #ifdef HAVE_TPACKET_STATS - /* - * Try to get the packet counts from the kernel. -@@ -879,6 +1221,11 @@ - } - } - -+ -+#ifdef RING -+ if(handle->ring_fd <= 0) can_filter_in_kernel = 0; -+#endif -+ - if (can_filter_in_kernel) { - if ((err = set_kernel_filter(handle, &fcode)) == 0) - { -@@ -1348,7 +1695,7 @@ - memset(&mr, 0, sizeof(mr)); - mr.mr_ifindex = device_id; - mr.mr_type = PACKET_MR_PROMISC; -- if (setsockopt(sock_fd, SOL_PACKET, -+ if (setsockopt(sock_fd, 0 /* SOL_PACKET */, - PACKET_ADD_MEMBERSHIP, &mr, sizeof(mr)) == -1) - { - snprintf(ebuf, PCAP_ERRBUF_SIZE, -@@ -1425,10 +1772,11 @@ - - /* Any pending errors, e.g., network is down? */ - -- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) { -- snprintf(ebuf, PCAP_ERRBUF_SIZE, -- "getsockopt: %s", pcap_strerror(errno)); -- return -2; -+ if ((getsockopt(fd, PF_RING, SO_ERROR, &err, &errlen) == -1) -+ && (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1)) { -+ snprintf(ebuf, PCAP_ERRBUF_SIZE, -+ "getsockopt: %s", pcap_strerror(errno)); -+ return -2; - } - - if (err > 0) { -@@ -1482,6 +1830,13 @@ - struct pcap *p, *prevp; - struct ifreq ifr; - -+#ifdef RING -+ if(handle->ring_buffer != NULL) { -+ munmap(handle->ring_buffer, handle->slots_info->tot_mem); -+ handle->ring_buffer = NULL; -+ } -+#endif -+ - if (handle->md.clear_promisc) { - /* - * We put the interface into promiscuous mode; take -@@ -1698,11 +2053,11 @@ - } - - /* Any pending errors, e.g., network is down? */ -- -- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) { -- snprintf(ebuf, PCAP_ERRBUF_SIZE, -- "getsockopt: %s", pcap_strerror(errno)); -- return -1; -+ if((getsockopt(fd, PF_RING, SO_ERROR, &err, &errlen) == -1) -+ && (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1)) { -+ snprintf(ebuf, PCAP_ERRBUF_SIZE, -+ "getsockopt: %s", pcap_strerror(errno)); -+ return -1; - } - - if (err > 0) { -@@ -1924,8 +2279,11 @@ - * the filtering done in userland even if it could have been - * done in the kernel. - */ -- if (setsockopt(handle->fd, SOL_SOCKET, SO_ATTACH_FILTER, -- &total_fcode, sizeof(total_fcode)) == 0) { -+ printf("pcap[setsockopt(%d)]\n", 0); -+ if (setsockopt(handle->fd, 0 /* SOL_SOCKET */, -+ SO_ATTACH_FILTER, -+ &total_fcode, -+ sizeof(total_fcode)) == 0) { - char drain[1]; - - /* -@@ -1933,6 +2291,9 @@ - */ - total_filter_on = 1; - -+#ifdef RING -+ if(!handle->ring_fd) { -+#endif - /* - * Save the socket's current mode, and put it in - * non-blocking mode; we drain it by reading packets -@@ -1955,12 +2316,15 @@ - return -2; - } - } -- } -+#ifdef RING -+ } -+#endif -+} - - /* - * Now attach the new filter. - */ -- ret = setsockopt(handle->fd, SOL_SOCKET, SO_ATTACH_FILTER, -+ ret = setsockopt(handle->fd, 0 /* SOL_SOCKET */, SO_ATTACH_FILTER, - fcode, sizeof(*fcode)); - if (ret == -1 && total_filter_on) { - /* -@@ -1993,7 +2357,8 @@ - /* setsockopt() barfs unless it get a dummy parameter */ - int dummy; - -- return setsockopt(handle->fd, SOL_SOCKET, SO_DETACH_FILTER, -- &dummy, sizeof(dummy)); -+ return setsockopt(handle->fd, handle->ring_fd > 0 ? PF_RING : SOL_SOCKET, -+ SO_DETACH_FILTER, -+ &dummy, sizeof(dummy)); - } - #endif -- cgit v1.2.3 From 82daa5e9c007b2a16aa9e8c5526fd8d034ee4541 Mon Sep 17 00:00:00 2001 From: mbm Date: Wed, 1 Feb 2006 23:53:19 +0000 Subject: change cp to $(CP) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3112 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 42bac4690..670bca0cd 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -65,15 +65,15 @@ $(PKG_BUILD_DIR)/.built: $(IPKG_LIBPCAP): install -m0755 -d $(IDIR_LIBPCAP)/usr/lib - cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/ $(RSTRIP) $(IDIR_LIBPCAP) $(IPKG_BUILD) $(IDIR_LIBPCAP) $(PACKAGE_DIR) $(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built mkdir -p $(STAGING_DIR)/usr/include - cp -fpR $(PKG_INSTALL_DIR)/usr/include/pcap* $(STAGING_DIR)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap* $(STAGING_DIR)/usr/include/ mkdir -p $(STAGING_DIR)/usr/lib - cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(STAGING_DIR)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(STAGING_DIR)/usr/lib/ touch $(STAGING_DIR)/usr/lib/libpcap.so install-dev: $(STAGING_DIR)/usr/lib/libpcap.so -- cgit v1.2.3 From 2b02642832677bd2d7d089aaebedf36b897e7ac0 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 5 Feb 2006 17:30:49 +0000 Subject: Updated libpcap to 0.9.4, tcpdump to 3.9.4 git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3139 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 6 +-- package/libpcap/patches/100-shared-lib.patch | 43 ++++++++++++---------- .../libpcap/patches/101-cross-compile-fix.patch | 9 +++-- package/libpcap/patches/102-alt-ether.patch | 21 ++++++----- 4 files changed, 42 insertions(+), 37 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 670bca0cd..67bc3f7fd 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -3,9 +3,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap -PKG_VERSION:=0.8.3 -PKG_RELEASE:=2 -PKG_MD5SUM:=56a9d4615d8354fcfe8cff8c8443c77b +PKG_VERSION:=0.9.4 +PKG_RELEASE:=1 +PKG_MD5SUM:=79025766e8027df154cb1f32de8a7974 PKG_SOURCE_URL:=http://www.tcpdump.org/release/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/package/libpcap/patches/100-shared-lib.patch b/package/libpcap/patches/100-shared-lib.patch index fbbef5b67..54cc774a3 100644 --- a/package/libpcap/patches/100-shared-lib.patch +++ b/package/libpcap/patches/100-shared-lib.patch @@ -1,12 +1,13 @@ ---- libpcap-0.8.3-orig/Makefile.in 2003-12-15 02:42:23.000000000 +0100 -+++ libpcap-0.8.3-7/Makefile.in 2005-03-08 03:38:22.000000000 +0100 +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2003-12-15 02:35:03.000000000 +0100 ++++ libpcap-0.9.4/Makefile.in 2006-02-05 16:56:18.000000000 +0100 @@ -37,6 +37,15 @@ srcdir = @srcdir@ VPATH = @srcdir@ +# some defines for shared library compilation -+MAJ=0.8 -+MIN=3 ++MAJ=0.9 ++MIN=4 +VERSION=$(MAJ).$(MIN) +LIBNAME=pcap +LIBRARY=lib$(LIBNAME).a @@ -16,7 +17,7 @@ # # You shouldn't need to edit anything below. # -@@ -49,6 +58,7 @@ +@@ -50,6 +59,7 @@ # Standard CFLAGS CFLAGS = $(CCOPT) $(INCLS) $(DEFS) @@ -24,20 +25,20 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -68,7 +78,11 @@ - # problem if you don't own the file but can write to the directory. +@@ -70,7 +80,12 @@ .c.o: @rm -f $@ -- $(CC) $(CFLAGS) -c $(srcdir)/$*.c + $(CC) $(CFLAGS) -c $(srcdir)/$*.c + $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c -+ + +%_pic.o: %.c + @rm -f $@ + $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c - ++ PSRC = pcap-@V_PCAP@.c FSRC = fad-@V_FINDALLDEVS@.c -@@ -83,6 +97,7 @@ + SSRC = @SSRC@ +@@ -84,6 +99,7 @@ # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot # hack the extra indirection OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) @@ -45,7 +46,7 @@ HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \ ethertype.h gencode.h gnuc.h GENHDR = \ -@@ -94,15 +109,22 @@ +@@ -95,15 +111,23 @@ TAGFILES = \ $(SRC) $(HDR) $(TAGHDR) @@ -67,20 +68,22 @@ + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) + - scanner.c: $(srcdir)/scanner.l - @rm -f $@ - $(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@ -@@ -110,6 +132,9 @@ ++ + shared: libpcap.$(DYEXT) + + # +@@ -129,6 +153,10 @@ scanner.o: scanner.c tokdefs.h $(CC) $(CFLAGS) -c scanner.c +scanner_pic.o: scanner.c tokdefs.h + $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c ++ + pcap.o: version.h tokdefs.h: grammar.c -@@ -123,9 +148,17 @@ +@@ -142,9 +170,16 @@ @rm -f $@ $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c @@ -93,19 +96,19 @@ +version_pic.o: version.c + $(CC) -fPIC $(CFLAGS) -c version.c -o $@ -+ + snprintf.o: $(srcdir)/missing/snprintf.c $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c -@@ -151,10 +184,16 @@ +@@ -170,10 +205,17 @@ bpf_filter.o: bpf_filter.c $(CC) $(CFLAGS) -c bpf_filter.c +bpf_filter_pic.o: bpf_filter.c + $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@ + - install: ++ + install: libpcap.a [ -d $(DESTDIR)$(libdir) ] || \ (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a diff --git a/package/libpcap/patches/101-cross-compile-fix.patch b/package/libpcap/patches/101-cross-compile-fix.patch index 196ee34eb..5ba78adae 100644 --- a/package/libpcap/patches/101-cross-compile-fix.patch +++ b/package/libpcap/patches/101-cross-compile-fix.patch @@ -1,6 +1,7 @@ ---- libpcap-0.8.3/Makefile.in.orig 2005-01-17 19:04:41.291056960 -0500 -+++ libpcap-0.8.3/Makefile.in 2005-01-17 19:04:47.836061968 -0500 -@@ -100,7 +100,7 @@ +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2006-02-05 16:57:16.000000000 +0100 ++++ libpcap-0.9.4/Makefile.in 2006-02-05 16:57:03.000000000 +0100 +@@ -117,7 +117,7 @@ libpcap.a: $(OBJ) @rm -f $@ @@ -8,4 +9,4 @@ + $(AR) rc $@ $(OBJ) $(LIBS) $(RANLIB) $@ - scanner.c: $(srcdir)/scanner.l + $(SHAREDLIB): $(OBJ_PIC) diff --git a/package/libpcap/patches/102-alt-ether.patch b/package/libpcap/patches/102-alt-ether.patch index d5e010ec6..347265d6e 100644 --- a/package/libpcap/patches/102-alt-ether.patch +++ b/package/libpcap/patches/102-alt-ether.patch @@ -1,6 +1,7 @@ ---- libpcap-0.8.3-orig/nametoaddr.c 2003-11-19 19:13:48.000000000 +0100 -+++ libpcap-0.8.3-7/nametoaddr.c 2005-03-08 03:38:22.000000000 +0100 -@@ -333,7 +333,7 @@ +diff -urN libpcap-0.9.4.orig/nametoaddr.c libpcap-0.9.4/nametoaddr.c +--- libpcap-0.9.4.orig/nametoaddr.c 2005-04-20 13:13:51.000000000 +0200 ++++ libpcap-0.9.4/nametoaddr.c 2006-02-05 16:58:46.000000000 +0100 +@@ -410,7 +410,7 @@ e = ep = (u_char *)malloc(6); while (*s) { @@ -9,17 +10,18 @@ s += 1; d = xdtoi(*s++); if (isxdigit((unsigned char)*s)) { ---- libpcap-0.8.3-orig/scanner.l 2004-03-28 23:45:33.000000000 +0200 -+++ libpcap-0.8.3-7/scanner.l 2005-03-08 03:38:22.000000000 +0100 +diff -urN libpcap-0.9.4.orig/scanner.l libpcap-0.9.4/scanner.l +--- libpcap-0.9.4.orig/scanner.l 2005-09-05 11:08:07.000000000 +0200 ++++ libpcap-0.9.4/scanner.l 2006-02-05 17:00:13.000000000 +0100 @@ -80,6 +80,7 @@ N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) B ([0-9A-Fa-f][0-9A-Fa-f]?) W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) -+X [0-9A-Fa-f] ++X [0-9A-Fa-f] %a 16000 %o 19000 -@@ -296,7 +297,7 @@ +@@ -306,7 +307,7 @@ {N} { yylval.i = stoi((char *)yytext); return NUM; } ({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { yylval.s = sdup((char *)yytext); return HID; } @@ -28,12 +30,11 @@ return EID; } {V6} { #ifdef INET6 -@@ -314,6 +315,8 @@ +@@ -324,6 +325,7 @@ #endif /*INET6*/ } {B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } -+{X}{12} { yylval.e = pcap_ether_aton((char *)yytext); return EID;} -+ ++{X}{12} { yylval.e = pcap_ether_aton((char *)yytext); return EID;} icmptype { yylval.i = 0; return NUM; } icmpcode { yylval.i = 1; return NUM; } icmp-echoreply { yylval.i = 0; return NUM; } -- cgit v1.2.3 From 737022a15e9e7b872ffd8220604f29c6e4bc399d Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 13 Apr 2006 22:20:15 +0000 Subject: remove lots of non-essential packages git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3641 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Config.in | 9 -- package/libpcap/Makefile | 86 --------------- package/libpcap/ipkg/libpcap.control | 4 - package/libpcap/patches/100-shared-lib.patch | 120 --------------------- .../libpcap/patches/101-cross-compile-fix.patch | 12 --- package/libpcap/patches/102-alt-ether.patch | 40 ------- 6 files changed, 271 deletions(-) delete mode 100644 package/libpcap/Config.in delete mode 100644 package/libpcap/Makefile delete mode 100644 package/libpcap/ipkg/libpcap.control delete mode 100644 package/libpcap/patches/100-shared-lib.patch delete mode 100644 package/libpcap/patches/101-cross-compile-fix.patch delete mode 100644 package/libpcap/patches/102-alt-ether.patch (limited to 'package/libpcap') diff --git a/package/libpcap/Config.in b/package/libpcap/Config.in deleted file mode 100644 index d2075647e..000000000 --- a/package/libpcap/Config.in +++ /dev/null @@ -1,9 +0,0 @@ -config BR2_PACKAGE_LIBPCAP - prompt "libpcap........................... Low-level packet capture library" - tristate - default m if CONFIG_DEVEL - help - A system-independent library for user-level network packet capture. - - http://www.tcpdump.org/ - diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile deleted file mode 100644 index 67bc3f7fd..000000000 --- a/package/libpcap/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -# $Id$ - -include $(TOPDIR)/rules.mk - -PKG_NAME:=libpcap -PKG_VERSION:=0.9.4 -PKG_RELEASE:=1 -PKG_MD5SUM:=79025766e8027df154cb1f32de8a7974 - -PKG_SOURCE_URL:=http://www.tcpdump.org/release/ -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_CAT:=zcat - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) -PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install - -include $(TOPDIR)/package/rules.mk - -$(eval $(call PKG_template,LIBPCAP,libpcap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) - -$(PKG_BUILD_DIR)/.configured: - (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ - $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(TARGET_CFLAGS)" \ - CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ - LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ - ac_cv_linux_vers=$(BR2_DEFAULT_KERNEL_HEADERS) \ - ./configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_TARGET_NAME) \ - --build=$(GNU_HOST_NAME) \ - --program-prefix="" \ - --program-suffix="" \ - --prefix=/usr \ - --exec-prefix=/usr \ - --bindir=/usr/bin \ - --datadir=/usr/share \ - --includedir=/usr/include \ - --infodir=/usr/share/info \ - --libdir=/usr/lib \ - --libexecdir=/usr/lib \ - --localstatedir=/var \ - --mandir=/usr/share/man \ - --sbindir=/usr/sbin \ - --sysconfdir=/etc \ - $(DISABLE_NLS) \ - $(DISABLE_LARGEFILE) \ - --enable-shared \ - --enable-static \ - --disable-yydebug \ - --enable-ipv6 \ - --with-build-cc=$(HOSTCC) \ - --with-pcap=linux \ - ); - touch $@ - -$(PKG_BUILD_DIR)/.built: - rm -rf $(PKG_INSTALL_DIR) - mkdir -p $(PKG_INSTALL_DIR) - $(MAKE) -C $(PKG_BUILD_DIR) \ - CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - all install - touch $@ - -$(IPKG_LIBPCAP): - install -m0755 -d $(IDIR_LIBPCAP)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(IDIR_LIBPCAP)/usr/lib/ - $(RSTRIP) $(IDIR_LIBPCAP) - $(IPKG_BUILD) $(IDIR_LIBPCAP) $(PACKAGE_DIR) - -$(STAGING_DIR)/usr/lib/libpcap.so: $(PKG_BUILD_DIR)/.built - mkdir -p $(STAGING_DIR)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap* $(STAGING_DIR)/usr/include/ - mkdir -p $(STAGING_DIR)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(STAGING_DIR)/usr/lib/ - touch $(STAGING_DIR)/usr/lib/libpcap.so - -install-dev: $(STAGING_DIR)/usr/lib/libpcap.so - -uninstall-dev: - rm -rf $(STAGING_DIR)/usr/include/pcap* - rm -rf $(STAGING_DIR)/usr/lib/libpcap.{a,so*} - -compile-targets: install-dev -clean-targets: uninstall-dev diff --git a/package/libpcap/ipkg/libpcap.control b/package/libpcap/ipkg/libpcap.control deleted file mode 100644 index a743ea4fc..000000000 --- a/package/libpcap/ipkg/libpcap.control +++ /dev/null @@ -1,4 +0,0 @@ -Package: libpcap -Priority: optional -Section: libs -Description: a low-level packet capture library diff --git a/package/libpcap/patches/100-shared-lib.patch b/package/libpcap/patches/100-shared-lib.patch deleted file mode 100644 index 54cc774a3..000000000 --- a/package/libpcap/patches/100-shared-lib.patch +++ /dev/null @@ -1,120 +0,0 @@ -diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in ---- libpcap-0.9.4.orig/Makefile.in 2003-12-15 02:35:03.000000000 +0100 -+++ libpcap-0.9.4/Makefile.in 2006-02-05 16:56:18.000000000 +0100 -@@ -37,6 +37,15 @@ - srcdir = @srcdir@ - VPATH = @srcdir@ - -+# some defines for shared library compilation -+MAJ=0.9 -+MIN=4 -+VERSION=$(MAJ).$(MIN) -+LIBNAME=pcap -+LIBRARY=lib$(LIBNAME).a -+SOLIBRARY=lib$(LIBNAME).so -+SHAREDLIB=$(SOLIBRARY).$(VERSION) -+ - # - # You shouldn't need to edit anything below. - # -@@ -50,6 +59,7 @@ - - # Standard CFLAGS - CFLAGS = $(CCOPT) $(INCLS) $(DEFS) -+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) - - INSTALL = @INSTALL@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -70,7 +80,12 @@ - .c.o: - @rm -f $@ - $(CC) $(CFLAGS) -c $(srcdir)/$*.c -+ $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c - -+%_pic.o: %.c -+ @rm -f $@ -+ $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c -+ - PSRC = pcap-@V_PCAP@.c - FSRC = fad-@V_FINDALLDEVS@.c - SSRC = @SSRC@ -@@ -84,6 +99,7 @@ - # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot - # hack the extra indirection - OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) -+OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) - HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \ - ethertype.h gencode.h gnuc.h - GENHDR = \ -@@ -95,15 +111,23 @@ - TAGFILES = \ - $(SRC) $(HDR) $(TAGHDR) - --CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c -+CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so* - --all: libpcap.a -+all: libpcap.a $(SHAREDLIB) - - libpcap.a: $(OBJ) - @rm -f $@ - ar rc $@ $(OBJ) $(LIBS) - $(RANLIB) $@ - -+$(SHAREDLIB): $(OBJ_PIC) -+ -@rm -f $@ -+ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ) -+ $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc -+ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) -+ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) -+ -+ - shared: libpcap.$(DYEXT) - - # -@@ -129,6 +153,10 @@ - scanner.o: scanner.c tokdefs.h - $(CC) $(CFLAGS) -c scanner.c - -+scanner_pic.o: scanner.c tokdefs.h -+ $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c -+ -+ - pcap.o: version.h - - tokdefs.h: grammar.c -@@ -142,9 +170,16 @@ - @rm -f $@ - $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c - -+grammar_pic.o: grammar.c -+ @rm -f $@ -+ $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c -+ - version.o: version.c - $(CC) $(CFLAGS) -c version.c - -+version_pic.o: version.c -+ $(CC) -fPIC $(CFLAGS) -c version.c -o $@ -+ - snprintf.o: $(srcdir)/missing/snprintf.c - $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c - -@@ -170,10 +205,17 @@ - bpf_filter.o: bpf_filter.c - $(CC) $(CFLAGS) -c bpf_filter.c - -+bpf_filter_pic.o: bpf_filter.c -+ $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@ -+ -+ - install: libpcap.a - [ -d $(DESTDIR)$(libdir) ] || \ - (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) - $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a -+ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/ -+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ) -+ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY) - $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a - [ -d $(DESTDIR)$(includedir) ] || \ - (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir)) diff --git a/package/libpcap/patches/101-cross-compile-fix.patch b/package/libpcap/patches/101-cross-compile-fix.patch deleted file mode 100644 index 5ba78adae..000000000 --- a/package/libpcap/patches/101-cross-compile-fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in ---- libpcap-0.9.4.orig/Makefile.in 2006-02-05 16:57:16.000000000 +0100 -+++ libpcap-0.9.4/Makefile.in 2006-02-05 16:57:03.000000000 +0100 -@@ -117,7 +117,7 @@ - - libpcap.a: $(OBJ) - @rm -f $@ -- ar rc $@ $(OBJ) $(LIBS) -+ $(AR) rc $@ $(OBJ) $(LIBS) - $(RANLIB) $@ - - $(SHAREDLIB): $(OBJ_PIC) diff --git a/package/libpcap/patches/102-alt-ether.patch b/package/libpcap/patches/102-alt-ether.patch deleted file mode 100644 index 347265d6e..000000000 --- a/package/libpcap/patches/102-alt-ether.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff -urN libpcap-0.9.4.orig/nametoaddr.c libpcap-0.9.4/nametoaddr.c ---- libpcap-0.9.4.orig/nametoaddr.c 2005-04-20 13:13:51.000000000 +0200 -+++ libpcap-0.9.4/nametoaddr.c 2006-02-05 16:58:46.000000000 +0100 -@@ -410,7 +410,7 @@ - e = ep = (u_char *)malloc(6); - - while (*s) { -- if (*s == ':') -+ if (*s == ':' || *s == '.') - s += 1; - d = xdtoi(*s++); - if (isxdigit((unsigned char)*s)) { -diff -urN libpcap-0.9.4.orig/scanner.l libpcap-0.9.4/scanner.l ---- libpcap-0.9.4.orig/scanner.l 2005-09-05 11:08:07.000000000 +0200 -+++ libpcap-0.9.4/scanner.l 2006-02-05 17:00:13.000000000 +0100 -@@ -80,6 +80,7 @@ - N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) - B ([0-9A-Fa-f][0-9A-Fa-f]?) - W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) -+X [0-9A-Fa-f] - - %a 16000 - %o 19000 -@@ -306,7 +307,7 @@ - {N} { yylval.i = stoi((char *)yytext); return NUM; } - ({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { - yylval.s = sdup((char *)yytext); return HID; } --{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext); -+({B}:{B}:{B}:{B}:{B}:{B})|({B}\.{B}\.{B}\.{B}\.{B}\.{B}) { yylval.e = pcap_ether_aton((char *)yytext); - return EID; } - {V6} { - #ifdef INET6 -@@ -324,6 +325,7 @@ - #endif /*INET6*/ - } - {B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } -+{X}{12} { yylval.e = pcap_ether_aton((char *)yytext); return EID;} - icmptype { yylval.i = 0; return NUM; } - icmpcode { yylval.i = 1; return NUM; } - icmp-echoreply { yylval.i = 0; return NUM; } -- cgit v1.2.3 From a8f632da6583439bddf8b41341f2d4f51ae884bb Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 24 May 2006 07:18:36 +0000 Subject: import libpcap from trunk and convert it to -ng. git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3825 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 97 +++++++++++++++++ package/libpcap/patches/100-shared-lib.patch | 120 +++++++++++++++++++++ .../libpcap/patches/101-cross-compile-fix.patch | 12 +++ package/libpcap/patches/102-alt-ether.patch | 40 +++++++ 4 files changed, 269 insertions(+) create mode 100644 package/libpcap/Makefile create mode 100644 package/libpcap/patches/100-shared-lib.patch create mode 100644 package/libpcap/patches/101-cross-compile-fix.patch create mode 100644 package/libpcap/patches/102-alt-ether.patch (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile new file mode 100644 index 000000000..960caf133 --- /dev/null +++ b/package/libpcap/Makefile @@ -0,0 +1,97 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libpcap +PKG_VERSION:=0.9.4 +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.tcpdump.org/release/ +PKG_MD5SUM:=79025766e8027df154cb1f32de8a7974 +PKG_CAT:=zcat + +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(TOPDIR)/package/rules.mk + +define Package/libpcap + SECTION:=base + CATEGORY:=Libraries + TITLE:=Low-level packet capture library + DESCRIPTION:=A system-independent library for user-level network packet capture. + URL:=http://www.tcpdump.org/ +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -f config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + ac_cv_linux_vers= \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --enable-shared \ + --enable-static \ + --disable-yydebug \ + --enable-ipv6 \ + --with-build-cc=$(HOSTCC) \ + --with-pcap=linux \ + ); +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/libpcap/install + install -m0755 -d $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/ +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap.h \ + $(PKG_INSTALL_DIR)/usr/include/pcap-bpf.h \ + $(PKG_INSTALL_DIR)/usr/include/pcap-namedb.h \ + $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.a \ + $(PKG_INSTALL_DIR)/usr/lib/libpcap.so* \ + $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/pcap.h \ + $(STAGING_DIR)/usr/include/pcap-bpf.h \ + $(STAGING_DIR)/usr/include/pcap-namedb.h \ + $(STAGING_DIR)/usr/lib/libpcap.a \ + $(STAGING_DIR)/usr/lib/libpcap.so* +endef + +$(eval $(call BuildPackage,libpcap)) diff --git a/package/libpcap/patches/100-shared-lib.patch b/package/libpcap/patches/100-shared-lib.patch new file mode 100644 index 000000000..54cc774a3 --- /dev/null +++ b/package/libpcap/patches/100-shared-lib.patch @@ -0,0 +1,120 @@ +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2003-12-15 02:35:03.000000000 +0100 ++++ libpcap-0.9.4/Makefile.in 2006-02-05 16:56:18.000000000 +0100 +@@ -37,6 +37,15 @@ + srcdir = @srcdir@ + VPATH = @srcdir@ + ++# some defines for shared library compilation ++MAJ=0.9 ++MIN=4 ++VERSION=$(MAJ).$(MIN) ++LIBNAME=pcap ++LIBRARY=lib$(LIBNAME).a ++SOLIBRARY=lib$(LIBNAME).so ++SHAREDLIB=$(SOLIBRARY).$(VERSION) ++ + # + # You shouldn't need to edit anything below. + # +@@ -50,6 +59,7 @@ + + # Standard CFLAGS + CFLAGS = $(CCOPT) $(INCLS) $(DEFS) ++CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) + + INSTALL = @INSTALL@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -70,7 +80,12 @@ + .c.o: + @rm -f $@ + $(CC) $(CFLAGS) -c $(srcdir)/$*.c ++ $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c + ++%_pic.o: %.c ++ @rm -f $@ ++ $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c ++ + PSRC = pcap-@V_PCAP@.c + FSRC = fad-@V_FINDALLDEVS@.c + SSRC = @SSRC@ +@@ -84,6 +99,7 @@ + # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot + # hack the extra indirection + OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) ++OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) + HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \ + ethertype.h gencode.h gnuc.h + GENHDR = \ +@@ -95,15 +111,23 @@ + TAGFILES = \ + $(SRC) $(HDR) $(TAGHDR) + +-CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c ++CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so* + +-all: libpcap.a ++all: libpcap.a $(SHAREDLIB) + + libpcap.a: $(OBJ) + @rm -f $@ + ar rc $@ $(OBJ) $(LIBS) + $(RANLIB) $@ + ++$(SHAREDLIB): $(OBJ_PIC) ++ -@rm -f $@ ++ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ) ++ $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc ++ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) ++ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) ++ ++ + shared: libpcap.$(DYEXT) + + # +@@ -129,6 +153,10 @@ + scanner.o: scanner.c tokdefs.h + $(CC) $(CFLAGS) -c scanner.c + ++scanner_pic.o: scanner.c tokdefs.h ++ $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c ++ ++ + pcap.o: version.h + + tokdefs.h: grammar.c +@@ -142,9 +170,16 @@ + @rm -f $@ + $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c + ++grammar_pic.o: grammar.c ++ @rm -f $@ ++ $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c ++ + version.o: version.c + $(CC) $(CFLAGS) -c version.c + ++version_pic.o: version.c ++ $(CC) -fPIC $(CFLAGS) -c version.c -o $@ ++ + snprintf.o: $(srcdir)/missing/snprintf.c + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c + +@@ -170,10 +205,17 @@ + bpf_filter.o: bpf_filter.c + $(CC) $(CFLAGS) -c bpf_filter.c + ++bpf_filter_pic.o: bpf_filter.c ++ $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@ ++ ++ + install: libpcap.a + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a ++ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/ ++ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ) ++ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY) + $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a + [ -d $(DESTDIR)$(includedir) ] || \ + (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir)) diff --git a/package/libpcap/patches/101-cross-compile-fix.patch b/package/libpcap/patches/101-cross-compile-fix.patch new file mode 100644 index 000000000..5ba78adae --- /dev/null +++ b/package/libpcap/patches/101-cross-compile-fix.patch @@ -0,0 +1,12 @@ +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2006-02-05 16:57:16.000000000 +0100 ++++ libpcap-0.9.4/Makefile.in 2006-02-05 16:57:03.000000000 +0100 +@@ -117,7 +117,7 @@ + + libpcap.a: $(OBJ) + @rm -f $@ +- ar rc $@ $(OBJ) $(LIBS) ++ $(AR) rc $@ $(OBJ) $(LIBS) + $(RANLIB) $@ + + $(SHAREDLIB): $(OBJ_PIC) diff --git a/package/libpcap/patches/102-alt-ether.patch b/package/libpcap/patches/102-alt-ether.patch new file mode 100644 index 000000000..347265d6e --- /dev/null +++ b/package/libpcap/patches/102-alt-ether.patch @@ -0,0 +1,40 @@ +diff -urN libpcap-0.9.4.orig/nametoaddr.c libpcap-0.9.4/nametoaddr.c +--- libpcap-0.9.4.orig/nametoaddr.c 2005-04-20 13:13:51.000000000 +0200 ++++ libpcap-0.9.4/nametoaddr.c 2006-02-05 16:58:46.000000000 +0100 +@@ -410,7 +410,7 @@ + e = ep = (u_char *)malloc(6); + + while (*s) { +- if (*s == ':') ++ if (*s == ':' || *s == '.') + s += 1; + d = xdtoi(*s++); + if (isxdigit((unsigned char)*s)) { +diff -urN libpcap-0.9.4.orig/scanner.l libpcap-0.9.4/scanner.l +--- libpcap-0.9.4.orig/scanner.l 2005-09-05 11:08:07.000000000 +0200 ++++ libpcap-0.9.4/scanner.l 2006-02-05 17:00:13.000000000 +0100 +@@ -80,6 +80,7 @@ + N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) + B ([0-9A-Fa-f][0-9A-Fa-f]?) + W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) ++X [0-9A-Fa-f] + + %a 16000 + %o 19000 +@@ -306,7 +307,7 @@ + {N} { yylval.i = stoi((char *)yytext); return NUM; } + ({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { + yylval.s = sdup((char *)yytext); return HID; } +-{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext); ++({B}:{B}:{B}:{B}:{B}:{B})|({B}\.{B}\.{B}\.{B}\.{B}\.{B}) { yylval.e = pcap_ether_aton((char *)yytext); + return EID; } + {V6} { + #ifdef INET6 +@@ -324,6 +325,7 @@ + #endif /*INET6*/ + } + {B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } ++{X}{12} { yylval.e = pcap_ether_aton((char *)yytext); return EID;} + icmptype { yylval.i = 0; return NUM; } + icmpcode { yylval.i = 1; return NUM; } + icmp-echoreply { yylval.i = 0; return NUM; } -- cgit v1.2.3 From 4e00d98efdec5bb2e6e19eccf85fcf9a0eecb646 Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 18 Jun 2006 18:30:40 +0000 Subject: normalize Makefiles. git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3998 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 960caf133..d4d7e2167 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -17,11 +17,11 @@ PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install include $(TOPDIR)/package/rules.mk define Package/libpcap - SECTION:=base - CATEGORY:=Libraries - TITLE:=Low-level packet capture library - DESCRIPTION:=A system-independent library for user-level network packet capture. - URL:=http://www.tcpdump.org/ +SECTION:=base +CATEGORY:=Libraries +TITLE:=Low-level packet capture library +DESCRIPTION:=A system-independent library for user-level network packet capture. +URL:=http://www.tcpdump.org/ endef define Build/Configure @@ -69,29 +69,23 @@ define Build/Compile all install endef -define Package/libpcap/install - install -m0755 -d $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/ -endef - define Build/InstallDev mkdir -p $(STAGING_DIR)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap.h \ - $(PKG_INSTALL_DIR)/usr/include/pcap-bpf.h \ - $(PKG_INSTALL_DIR)/usr/include/pcap-namedb.h \ + $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap{,-bpf,-namedb}.h \ $(STAGING_DIR)/usr/include/ mkdir -p $(STAGING_DIR)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.a \ - $(PKG_INSTALL_DIR)/usr/lib/libpcap.so* \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} \ $(STAGING_DIR)/usr/lib/ endef define Build/UninstallDev - rm -rf $(STAGING_DIR)/usr/include/pcap.h \ - $(STAGING_DIR)/usr/include/pcap-bpf.h \ - $(STAGING_DIR)/usr/include/pcap-namedb.h \ - $(STAGING_DIR)/usr/lib/libpcap.a \ - $(STAGING_DIR)/usr/lib/libpcap.so* + rm -rf $(STAGING_DIR)/usr/include/pcap{,-bpf,-named}.h \ + $(STAGING_DIR)/usr/lib/libpcap.{a,so*} +endef + +define Package/libpcap/install + install -m0755 -d $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/ endef $(eval $(call BuildPackage,libpcap)) -- cgit v1.2.3 From 859e8f7f7d8bfbefd610d338d16498190cd51e15 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 21 Jun 2006 02:16:37 +0000 Subject: build system cleanup. move shared include files into $(TOPDIR)/include, move lzma, mkfs.* into toolchain/ git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4032 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index d4d7e2167..2d7aecf55 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -14,7 +14,7 @@ PKG_CAT:=zcat PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install -include $(TOPDIR)/package/rules.mk +include $(TOPDIR)/include/package.mk define Package/libpcap SECTION:=base -- cgit v1.2.3 From 0b0afa4d818ec18187b09055fbb8d84a01590d6e Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 21 Jun 2006 02:32:39 +0000 Subject: add INCLUDE_DIR variable for $(TOPDIR)/include git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4033 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 2d7aecf55..0ded09a90 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -14,7 +14,7 @@ PKG_CAT:=zcat PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install -include $(TOPDIR)/include/package.mk +include $(INCLUDE_DIR)/package.mk define Package/libpcap SECTION:=base -- cgit v1.2.3 From 02cdebbb91a33d8e24da1c94a9d93ac39be168a7 Mon Sep 17 00:00:00 2001 From: mbm Date: Tue, 27 Jun 2006 00:35:46 +0000 Subject: credit where credit is due git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4091 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 0ded09a90..76c88af9c 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -1,3 +1,9 @@ +# +# 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 -- cgit v1.2.3 From b155a7112aa89b751711bc563ce9e3be6ecc16a1 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 19 Jul 2006 13:16:20 +0000 Subject: add workaround for a broken flex version on some systems (e.g. fc4) git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4167 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/patches/103-flex_workaround.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 package/libpcap/patches/103-flex_workaround.patch (limited to 'package/libpcap') diff --git a/package/libpcap/patches/103-flex_workaround.patch b/package/libpcap/patches/103-flex_workaround.patch new file mode 100644 index 000000000..5b6d0db0c --- /dev/null +++ b/package/libpcap/patches/103-flex_workaround.patch @@ -0,0 +1,14 @@ + + Copyright (C) 2006 Markus Wigge + +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2006-07-19 09:27:47.000000000 +0200 ++++ libpcap-0.9.4/Makefile.in 2006-07-19 09:34:48.000000000 +0200 +@@ -53,7 +53,7 @@ + CC = @CC@ + CCOPT = @V_CCOPT@ + INCLS = -I. @V_INCLS@ +-DEFS = @DEFS@ @V_DEFS@ ++DEFS = -D_BSD_SOURCE @DEFS@ @V_DEFS@ + LIBS = @V_LIBS@ + DYEXT = @DYEXT@ -- cgit v1.2.3 From 8b379ad6296f23d04b8a73b70d6a88cb78634244 Mon Sep 17 00:00:00 2001 From: mbm Date: Fri, 4 Aug 2006 03:26:32 +0000 Subject: add quotes to TARGET_CC and TARGET_CROSS to help with distcc and ccache git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4429 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 76c88af9c..1d9d4371f 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -61,7 +61,7 @@ define Build/Configure --enable-static \ --disable-yydebug \ --enable-ipv6 \ - --with-build-cc=$(HOSTCC) \ + --with-build-cc="$(HOSTCC)" \ --with-pcap=linux \ ); endef -- cgit v1.2.3 From 001227b7800328fe3db15d62e0948d25dfa596f6 Mon Sep 17 00:00:00 2001 From: mbm Date: Fri, 4 Aug 2006 05:30:27 +0000 Subject: more cleanup (make sure to pass TARGET_PATH and not just TARGET_CC) git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4432 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 1d9d4371f..155748a47 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -71,6 +71,7 @@ define Build/Compile mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) \ CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \ + PATH=$(TARGET_PATH) \ DESTDIR="$(PKG_INSTALL_DIR)" \ all install endef -- cgit v1.2.3 From ef998d64e381ed0a92fc73edf4206f7be7335caf Mon Sep 17 00:00:00 2001 From: mbm Date: Fri, 4 Aug 2006 11:59:52 +0000 Subject: set PATH in rules.mk git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4438 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 155748a47..1d9d4371f 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -71,7 +71,6 @@ define Build/Compile mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) \ CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \ - PATH=$(TARGET_PATH) \ DESTDIR="$(PKG_INSTALL_DIR)" \ all install endef -- cgit v1.2.3 From 46d9b2065a012d0e95ff0285854d4fdde0904d6b Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 23 Sep 2006 19:29:00 +0000 Subject: standardize Makefile, change section from base to libs git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4842 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 1d9d4371f..4fd1acae1 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -23,11 +23,13 @@ PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install include $(INCLUDE_DIR)/package.mk define Package/libpcap -SECTION:=base -CATEGORY:=Libraries -TITLE:=Low-level packet capture library -DESCRIPTION:=A system-independent library for user-level network packet capture. -URL:=http://www.tcpdump.org/ + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Low-level packet capture library + DESCRIPTION:=\ + This package contains a system-independent library for user-level \\\ + network packet capture. + URL:=http://www.tcpdump.org/ endef define Build/Configure @@ -67,8 +69,6 @@ define Build/Configure endef define Build/Compile - rm -rf $(PKG_INSTALL_DIR) - mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) \ CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \ DESTDIR="$(PKG_INSTALL_DIR)" \ -- cgit v1.2.3 From 8afb23270d23db6a033ba8fb77e1cf1a1d925a7c Mon Sep 17 00:00:00 2001 From: nico Date: Sun, 24 Sep 2006 20:49:31 +0000 Subject: new (last?) attempt at standardizing Makefiles git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4855 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libpcap/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/libpcap') diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile index 4fd1acae1..f8de02d55 100644 --- a/package/libpcap/Makefile +++ b/package/libpcap/Makefile @@ -12,12 +12,12 @@ PKG_NAME:=libpcap PKG_VERSION:=0.9.4 PKG_RELEASE:=1 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.tcpdump.org/release/ PKG_MD5SUM:=79025766e8027df154cb1f32de8a7974 PKG_CAT:=zcat +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install include $(INCLUDE_DIR)/package.mk -- cgit v1.2.3