mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 03:11:48 +00:00
Make NMAP_MODIFICATIONS into a directory with discrete patch files.
This commit is contained in:
parent
5d24d23600
commit
75856fd1dd
5 changed files with 284 additions and 0 deletions
|
|
@ -0,0 +1,123 @@
|
|||
From c0ccc9cd933823a642b1ccfa4c78fea1b672e731 Mon Sep 17 00:00:00 2001
|
||||
From: David Fifield <david@bamsoftware.com>
|
||||
Date: Mon, 9 Apr 2012 16:55:51 -0700
|
||||
Subject: [PATCH 1/4] Don't autogenerate Lex/Yacc files.
|
||||
|
||||
---
|
||||
Makefile.in | 30 ++++++++++--------------------
|
||||
configure.in | 20 --------------------
|
||||
2 files changed, 10 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git Makefile.in Makefile.in
|
||||
index 912b7e3..0db12a4 100644
|
||||
--- Makefile.in
|
||||
+++ Makefile.in
|
||||
@@ -67,14 +67,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
-#
|
||||
-# Flex and bison allow you to specify the prefixes of the global symbols
|
||||
-# used by the generated parser. This allows programs to use lex/yacc
|
||||
-# and link against libpcap. If you don't have flex or bison, get them.
|
||||
-#
|
||||
-LEX = @V_LEX@
|
||||
-YACC = @V_YACC@
|
||||
-
|
||||
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
|
||||
# Also, gcc does not remove the .o before forking 'as', which can be a
|
||||
# problem if you don't own the file but can write to the directory.
|
||||
@@ -147,7 +139,7 @@ TAGFILES = \
|
||||
$(SRC) $(HDR)
|
||||
|
||||
CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
|
||||
- $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
|
||||
+ $(PROG)-`cat $(srcdir)/VERSION`.tar.gz \
|
||||
lex.yy.c pcap-config
|
||||
|
||||
MAN1 = pcap-config.1
|
||||
@@ -345,6 +337,15 @@ EXTRA_DIST = \
|
||||
|
||||
all: libpcap.a shared pcap-config
|
||||
|
||||
+# Inhibit implicit rule Make seems to have for using yacc/lex to
|
||||
+# recompile new scanner.c/grammar.c -- we ship ones which we want to
|
||||
+# use instead.
|
||||
+grammar.c:
|
||||
+ echo "Not rebuilding grammar.c"
|
||||
+
|
||||
+scanner.c:
|
||||
+ echo "Not rebuilding scanner.c"
|
||||
+
|
||||
libpcap.a: $(OBJ)
|
||||
@rm -f $@
|
||||
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
||||
@@ -428,22 +429,11 @@ libpcap.shareda: $(OBJ)
|
||||
#
|
||||
libpcap.none:
|
||||
|
||||
-scanner.c: $(srcdir)/scanner.l
|
||||
- @rm -f $@
|
||||
- $(srcdir)/runlex.sh $(LEX) -o$@ $<
|
||||
-
|
||||
scanner.o: scanner.c tokdefs.h
|
||||
$(CC) $(FULL_CFLAGS) -c scanner.c
|
||||
|
||||
pcap.o: version.h
|
||||
|
||||
-tokdefs.h: grammar.c
|
||||
-grammar.c: $(srcdir)/grammar.y
|
||||
- @rm -f grammar.c tokdefs.h
|
||||
- $(YACC) -d $<
|
||||
- mv y.tab.c grammar.c
|
||||
- mv y.tab.h tokdefs.h
|
||||
-
|
||||
grammar.o: grammar.c
|
||||
@rm -f $@
|
||||
$(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
|
||||
diff --git configure.in configure.in
|
||||
index 6a146ca..24097b2 100644
|
||||
--- configure.in
|
||||
+++ configure.in
|
||||
@@ -998,24 +998,6 @@ if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
|
||||
AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
|
||||
fi
|
||||
|
||||
-AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
|
||||
-if test "$V_LEX" = lex ; then
|
||||
-# Some versions of lex can't handle the definitions section of scanner.l .
|
||||
-# Try lexing it and complain if it can't deal.
|
||||
- AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
|
||||
- if lex -t scanner.l > /dev/null 2>&1; then
|
||||
- tcpdump_cv_capable_lex=yes
|
||||
- else
|
||||
- tcpdump_cv_capable_lex=insufficient
|
||||
- fi)
|
||||
- if test $tcpdump_cv_capable_lex = insufficient ; then
|
||||
- AC_MSG_ERROR([Your operating system's lex is insufficient to compile
|
||||
- libpcap. flex is a lex replacement that has many advantages, including
|
||||
- being able to compile libpcap. For more information, see
|
||||
- http://www.gnu.org/software/flex/flex.html .])
|
||||
- fi
|
||||
-fi
|
||||
-
|
||||
#
|
||||
# Assume, by default, no support for shared libraries and V7/BSD convention
|
||||
# for man pages (file formats in section 5, miscellaneous info in section 7).
|
||||
@@ -1250,13 +1232,11 @@ AC_SUBST(V_CCOPT)
|
||||
AC_SUBST(V_DEFS)
|
||||
AC_SUBST(V_FINDALLDEVS)
|
||||
AC_SUBST(V_INCLS)
|
||||
-AC_SUBST(V_LEX)
|
||||
AC_SUBST(V_PCAP)
|
||||
AC_SUBST(V_SHLIB_CMD)
|
||||
AC_SUBST(V_SHLIB_OPT)
|
||||
AC_SUBST(V_SONAME_OPT)
|
||||
AC_SUBST(V_RPATH_OPT)
|
||||
-AC_SUBST(V_YACC)
|
||||
AC_SUBST(ADDLOBJS)
|
||||
AC_SUBST(ADDLARCHIVEOBJS)
|
||||
AC_SUBST(SSRC)
|
||||
--
|
||||
1.7.9.5
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From d7f1dc6156f619b81de682a0c89cf47884a798de Mon Sep 17 00:00:00 2001
|
||||
From: David Fifield <david@bamsoftware.com>
|
||||
Date: Mon, 9 Apr 2012 17:06:04 -0700
|
||||
Subject: [PATCH 2/4] Move the inclusion of config.h to the top of scanner.l.
|
||||
|
||||
This works around _LARGE_FILES difficulties on AIX.
|
||||
---
|
||||
scanner.l | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git scanner.l scanner.l
|
||||
index 064e9c8..93d7b97 100644
|
||||
--- scanner.l
|
||||
+++ scanner.l
|
||||
@@ -1,3 +1,10 @@
|
||||
+%top{
|
||||
+/* Must come first for _LARGE_FILE_API on AIX. */
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+#include "config.h"
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
%{
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
@@ -25,10 +32,6 @@ static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.112 2008-02-06 10:21:30 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_CONFIG_H
|
||||
-#include "config.h"
|
||||
-#endif
|
||||
-
|
||||
#ifdef WIN32
|
||||
#include <pcap-stdinc.h>
|
||||
#else /* WIN32 */
|
||||
--
|
||||
1.7.9.5
|
||||
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
From edb5f1e2f1d2a010f2d4a1e421efc7895b9e41c9 Mon Sep 17 00:00:00 2001
|
||||
From: David Fifield <david@bamsoftware.com>
|
||||
Date: Mon, 9 Apr 2012 17:02:40 -0700
|
||||
Subject: [PATCH 3/4] Add the --disable-packet-ring configure option.
|
||||
|
||||
This allows the creation of 32-bit binaries that are compatible with
|
||||
64-bit Linux kernels before version 2.6.27.
|
||||
---
|
||||
configure.in | 18 ++++++++++++++++++
|
||||
pcap-linux.c | 18 ++++++++++--------
|
||||
2 files changed, 28 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git configure.in configure.in
|
||||
index 24097b2..5eca6ab 100644
|
||||
--- configure.in
|
||||
+++ configure.in
|
||||
@@ -1404,6 +1404,24 @@ linux*)
|
||||
;;
|
||||
esac
|
||||
|
||||
+dnl The packet ring capture facility of Linux, described in
|
||||
+dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before
|
||||
+dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for
|
||||
+dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run
|
||||
+dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a
|
||||
+dnl kernel struct). This problem was solved in Linux 2.6.27. Use
|
||||
+dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit
|
||||
+dnl target host, and either the build host or the target host run Linux 2.6.26
|
||||
+dnl or earlier.
|
||||
+AC_ARG_ENABLE([packet-ring],
|
||||
+[AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])],
|
||||
+,enable_packet_ring=yes)
|
||||
+
|
||||
+if test "x$enable_packet_ring" != "xno" ; then
|
||||
+ AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available])
|
||||
+ AC_SUBST(PCAP_SUPPORT_PACKET_RING)
|
||||
+fi
|
||||
+
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
diff --git pcap-linux.c pcap-linux.c
|
||||
index d4f50b7..213558b 100644
|
||||
--- pcap-linux.c
|
||||
+++ pcap-linux.c
|
||||
@@ -219,14 +219,16 @@ static const char rcsid[] _U_ =
|
||||
/* check for memory mapped access avaibility. We assume every needed
|
||||
* struct is defined if the macro TPACKET_HDRLEN is defined, because it
|
||||
* uses many ring related structs and macros */
|
||||
-# ifdef TPACKET_HDRLEN
|
||||
-# define HAVE_PACKET_RING
|
||||
-# ifdef TPACKET2_HDRLEN
|
||||
-# define HAVE_TPACKET2
|
||||
-# else
|
||||
-# define TPACKET_V1 0
|
||||
-# endif /* TPACKET2_HDRLEN */
|
||||
-# endif /* TPACKET_HDRLEN */
|
||||
+# ifdef PCAP_SUPPORT_PACKET_RING
|
||||
+# ifdef TPACKET_HDRLEN
|
||||
+# define HAVE_PACKET_RING
|
||||
+# ifdef TPACKET2_HDRLEN
|
||||
+# define HAVE_TPACKET2
|
||||
+# else
|
||||
+# define TPACKET_V1 0
|
||||
+# endif /* TPACKET2_HDRLEN */
|
||||
+# endif /* TPACKET_HDRLEN */
|
||||
+# endif /* PCAP_SUPPORT_PACKET_RING */
|
||||
#endif /* PF_PACKET */
|
||||
|
||||
#ifdef SO_ATTACH_FILTER
|
||||
--
|
||||
1.7.9.5
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From 289ac878ff758d548628e7702618db3b0e141e0c Mon Sep 17 00:00:00 2001
|
||||
From: David Fifield <david@bamsoftware.com>
|
||||
Date: Mon, 9 Apr 2012 17:10:19 -0700
|
||||
Subject: [PATCH 4/4] Add a memset call that removes a Valgrind error.
|
||||
|
||||
http://seclists.org/nmap-dev/2010/q3/796
|
||||
---
|
||||
pcap-linux.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git pcap-linux.c pcap-linux.c
|
||||
index 213558b..97092ac 100644
|
||||
--- pcap-linux.c
|
||||
+++ pcap-linux.c
|
||||
@@ -2315,6 +2315,7 @@ pcap_setfilter_linux_common(pcap_t *handle, struct bpf_program *filter,
|
||||
struct sock_fprog fcode;
|
||||
int can_filter_in_kernel;
|
||||
int err = 0;
|
||||
+ memset(&fcode, 0, sizeof(struct sock_fprog));
|
||||
#endif
|
||||
|
||||
if (!handle)
|
||||
--
|
||||
1.7.9.5
|
||||
|
||||
24
libpcap/NMAP_MODIFICATIONS/HOWTO-UPGRADE
Normal file
24
libpcap/NMAP_MODIFICATIONS/HOWTO-UPGRADE
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Download libpcap-X.Y.tar.gz from http://www.tcpdump.org/#latest-release
|
||||
and verify the signature.
|
||||
|
||||
cd
|
||||
# Make a copy of this directory.
|
||||
cp -r ~/nmap/NMAP_MODIFICATIONS .
|
||||
tar xzvf libpcap-X.Y.tar.gz
|
||||
cd nmap
|
||||
rsync -rv --delete ~/libpcap-X.Y/ ~/nmap/libpcap/
|
||||
git add -A libpcap
|
||||
cd libpcap
|
||||
./configure
|
||||
make grammar.c scanner.c scanner.h tokdefs.h
|
||||
git add grammar.c scanner.c scanner.h tokdefs.h
|
||||
cd ..
|
||||
# Apply patches.
|
||||
git apply -p0 --directory=libpcap/ ~/NMAP_MODIFICATIONS/000*
|
||||
cd libpcap
|
||||
autoconf
|
||||
cd ..
|
||||
git add -u libpcap
|
||||
mv ~/NMAP_MODIFICATIONS libpcap/
|
||||
git add libpcap/NMAP_MODIFICATIONS
|
||||
git commit -m "Upgrade libpcap to X.Y."
|
||||
Loading…
Add table
Add a link
Reference in a new issue