aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS276
-rw-r--r--Makefile.in6
-rw-r--r--Win32/Src/getaddrinfo.c11
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure319
-rw-r--r--configure.in57
-rw-r--r--gencode.c2
-rw-r--r--inet.c6
-rw-r--r--pcap-common.c21
-rw-r--r--pcap-config.in31
-rw-r--r--pcap-linux.c130
-rw-r--r--pcap-usb-linux.c9
-rw-r--r--pcap-win32.c5
-rw-r--r--pcap.c2
-rw-r--r--pcap/bpf.h20
-rw-r--r--scanner.l2
-rw-r--r--sf-pcap-ng.c2
17 files changed, 675 insertions, 230 deletions
diff --git a/CREDITS b/CREDITS
index 035884d..c086450 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1,148 +1,148 @@
This file lists people who have contributed to libpcap:
The current maintainers:
- Bill Fenner <fenner at research dot att dot com>
- Fulvio Risso <risso at polito dot it>
- Guy Harris <guy at alum dot mit dot edu>
- Hannes Gredler <hannes at juniper dot net>
- Michael Richardson <mcr at sandelman dot ottawa dot on dot ca>
+ Bill Fenner <fenner at research dot att dot com>
+ Fulvio Risso <risso at polito dot it>
+ Guy Harris <guy at alum dot mit dot edu>
+ Hannes Gredler <hannes at juniper dot net>
+ Michael Richardson <mcr at sandelman dot ottawa dot on dot ca>
Additional people who have contributed patches:
- Alan Bawden <Alan at LCS dot MIT dot EDU>
- Albert Chin <china at thewrittenword dot com>
- Alexander 'Leo' Bergolth <Leo dot Bergolth at wu-wien dot ac dot at>
- Alexey Kuznetsov <kuznet at ms2 dot inr dot ac dot ru>
- Alon Bar-Lev <alonbl at sourceforge dot net>
- Andrew Brown <atatat at atatdot dot net>
- <andy-1 at sourceforge dot net>
- Antti Kantee <pooka at netbsd dot org>
- Arien Vijn <arienvijn at sourceforge dot net>
- Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
- Armando L. Caro Jr. <acaro at mail dot eecis dot udel dot edu>
- Assar Westerlund <assar at sics dot se>
- Brian Ginsbach <ginsbach at cray dot com>
- Charles M. Hannum <mycroft at netbsd dot org>
- Chris G. Demetriou <cgd at netbsd dot org>
- Chris Lightfoot <cwrl at users dot sourceforge dot net>
- Chris Maynard <Chris dot Maynard at gtech dot com>
- Chris Pepper <pepper at mail dot reppep dot com>
- Christian Bell <csbell at myri dot com>
- Christian Peron <csjp at freebsd dot org>
- Daniele Orlandi <daniele at orlandi dot com>
- Darren Reed <darrenr at sun dot com>
- David Kaelbling <drk at sgi dot com>
- David Young <dyoung at ojctech dot com>
- Dean Gaudet <dean at arctic dot org>
- Don Ebright <Don dot Ebright at compuware dot com>
- Dug Song <dugsong at monkey dot org>
- Dustin Spicuzza <dustin at virtualroadside dot com>
- Eric Anderson <anderse at hpl dot hp dot com>
- Erik de Castro Lopo <erik dot de dot castro dot lopo at sensorynetworks dot com>
- Felix Obenhuber <felix at obenhuber dot de>
- Florent Drouin <Florent dot Drouin at alcatel-lucent dot fr>
- Franz Schaefer <schaefer at mond dot at>
- Fulko Hew <fulko dot hew at gmail dot com>
- Fumiyuki Shimizu <fumifumi at abacustech dot jp>
- Gianluca Varenni <varenni at netgroup-serv dot polito dot it>
- Gilbert Hoyek <gil_hoyek at hotmail dot com>
- Gisle Vanem <gvanem at broadpark dot no>
- Graeme Hewson <ghewson at cix dot compulink dot co dot uk>
- Greg Stark <gsstark at mit dot edu>
- Greg Troxel <gdt at ir dot bbn dot com>
- Gregor Maier <gregor at net dot in dot tum dot de>
- Guillaume Pelat <endymion_ at users dot sourceforge dot net>
- Hagen Paul Pfeifer <hagen at jauu dot net>
- Hyung Sik Yoon <hsyn at kr dot ibm dot com>
- Igor Khristophorov <igor at atdot dot org>
- Jan-Philip Velders <jpv at veldersjes dot net>
- Jason R. Thorpe <thorpej at netbsd dot org>
- Javier Achirica <achirica at ttd dot net>
- Jean Tourrilhes <jt at hpl dot hp dot com>
- Jean-Louis Charton <Jean-Louis.CHARTON at oikialog dot com>
- Jefferson Ogata <jogata at nodc dot noaa dot gov>
- Jesper Peterson <jesper at endace dot com>
- Joerg Mayer <jmayer at loplof dot de>
- John Bankier <jbankier at rainfinity dot com>
- Jon Lindgren <jonl at yubyub dot net>
- Jon Smirl <jonsmirl at gmail dot com>
- Juergen Schoenwaelder <schoenw at ibr dot cs dot tu-bs dot de>
- Jung-uk Kim <jkim at FreeBSD dot org>
- Kazushi Sugyo <sugyo at pb dot jp dot nec dot com>
- Klaus Klein <kleink at netbsd dot org>
- Koryn Grant <koryn at endace dot com>
- Kris Katterjohn <katterjohn at gmail dot com>
- Krzysztof Halasa <khc at pm dot waw dot pl>
- Lorenzo Cavallaro <sullivan at sikurezza dot org>
- Loris Degioanni <loris at netgroup-serv dot polito dot it>
- Love Hörnquist-Åstrand <lha at stacken dot kth dot se>
- Luis Martin Garcia <luis dot mgarc at gmail dot com>
- Maciej W. Rozycki <macro at ds2 dot pg dot gda dot pl>
- Marcus Felipe Pereira <marcus at task dot com dot br>
- Mark C. Brown <mbrown at hp dot com>
- Mark Pizzolato <List-tcpdump-workers at subscriptions dot pizzolato dot net>
- Markus Mayer <markus_mayer at sourceforge dot net>
- Martin Husemann <martin at netbsd dot org>
- Márton Németh <nm127 at freemail dot hu>
- Matthew Luckie <mjl at luckie dot org dot nz>
- Max Laier <max at love2party dot net>
- Mike Frysinger <vapier at gmail dot com>
- Mike Kershaw <dragorn at kismetwireless dot net>
- Mike Wiacek <mike at iroot dot net>
- Monroe Williams <monroe at pobox dot com>
- <nvercamm at sourceforge dot net>
- N. Leiten <nleiten at sourceforge dot net>
- Nicolas Dade <ndade at nsd dot dyndns dot org>
- Octavian Cerna <tavy at ylabs dot com>
- Olaf Kirch <okir at caldera dot de>
- Ollie Wild <aaw at users dot sourceforge dot net>
- Onno van der Linden <onno at simplex dot nl>
- Paolo Abeni <paolo dot abeni at email dot it>
- Patrick Marie <mycroft at virgaria dot org>
- Patrick McHardy <kaber at trash not net>
- Paul Mundt <lethal at linux-sh dot org>
- Pavel Kankovsky <kan at dcit dot cz>
- Pawel Pokrywka <publicpp at gmail dot com>
- Peter Fales <peter at fales-lorenz dot net>
- Peter Jeremy <peter dot jeremy at alcatel dot com dot au>
- Peter Volkov <pva at gentoo dot org>
- Phil Wood <cpw at lanl dot gov>
- Rafal Maszkowski <rzm at icm dot edu dot pl>
- <rcb-isis at users dot sourceforge dot net>
- Richard Stearn <richard at rns-stearn dot demon dot co dot uk>
- Rick Jones <raj at cup dot hp dot com>
- Robert Edmonds <stu-42 at sourceforge dot net>
- Roberto Mariani <jelot-tcpdump at jelot dot it>
- Romain Francoise <rfrancoise at debian dot org>
- Sagun Shakya <sagun dot shakya at sun dot com>
- Scott Barron <sb125499 at ohiou dot edu>
- Scott Gifford <sgifford at tir dot com>
- Scott Mcmillan <scott.a.mcmillan at intel dot com>
- Sebastian Krahmer <krahmer at cs dot uni-potsdam dot de>
- Sebastien Roy <Sebastien dot Roy at Sun dot COM>
- Sepherosa Ziehau <sepherosa at gmail dot com>
- Shaun Clowes <delius at progsoc dot uts dot edu dot au>
- Solomon Peachy <pizza at shaftnet dot org>
- Stefan Hudson <hudson at mbay dot net>
- Stephen Donnelly <stephen at endace dot com>
- Takashi Yamamoto <yamt at mwd dot biglobe dot ne dot jp>
- Tanaka Shin-ya <zstanaka at archer dot livedoor dot com>
- Tobias Poschwatta <posch at sourceforge dot net>
- Tony Li <tli at procket dot com>
- Torsten Landschoff <torsten at debian dot org>
- Uns Lider <unslider at miranda dot org>
- Uwe Girlich <Uwe dot Girlich at philosys dot de>
- Wesley Shields <wxs at FreeBSD dot org>
- Xianjie Zhang <xzhang at cup dot hp dot com>
- Xin Li <delphij at FreeBSD dot org>
- Yen Yen Lim
- Yvan Vanhullebus <vanhu at sourceforge dot net>
- Yoann Vandoorselaere <yoann at prelude-ids dot org>
+ Alan Bawden <Alan at LCS dot MIT dot EDU>
+ Albert Chin <china at thewrittenword dot com>
+ Alexander 'Leo' Bergolth <Leo dot Bergolth at wu-wien dot ac dot at>
+ Alexey Kuznetsov <kuznet at ms2 dot inr dot ac dot ru>
+ Alon Bar-Lev <alonbl at sourceforge dot net>
+ Andrew Brown <atatat at atatdot dot net>
+ <andy-1 at sourceforge dot net>
+ Antti Kantee <pooka at netbsd dot org>
+ Arien Vijn <arienvijn at sourceforge dot net>
+ Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
+ Armando L. Caro Jr. <acaro at mail dot eecis dot udel dot edu>
+ Assar Westerlund <assar at sics dot se>
+ Brian Ginsbach <ginsbach at cray dot com>
+ Charles M. Hannum <mycroft at netbsd dot org>
+ Chris G. Demetriou <cgd at netbsd dot org>
+ Chris Lightfoot <cwrl at users dot sourceforge dot net>
+ Chris Maynard <Chris dot Maynard at gtech dot com>
+ Chris Pepper <pepper at mail dot reppep dot com>
+ Christian Bell <csbell at myri dot com>
+ Christian Peron <csjp at freebsd dot org>
+ Daniele Orlandi <daniele at orlandi dot com>
+ Darren Reed <darrenr at sun dot com>
+ David Kaelbling <drk at sgi dot com>
+ David Young <dyoung at ojctech dot com>
+ Dean Gaudet <dean at arctic dot org>
+ Don Ebright <Don dot Ebright at compuware dot com>
+ Dug Song <dugsong at monkey dot org>
+ Dustin Spicuzza <dustin at virtualroadside dot com>
+ Eric Anderson <anderse at hpl dot hp dot com>
+ Erik de Castro Lopo <erik dot de dot castro dot lopo at sensorynetworks dot com>
+ Felix Obenhuber <felix at obenhuber dot de>
+ Florent Drouin <Florent dot Drouin at alcatel-lucent dot fr>
+ Franz Schaefer <schaefer at mond dot at>
+ Fulko Hew <fulko dot hew at gmail dot com>
+ Fumiyuki Shimizu <fumifumi at abacustech dot jp>
+ Gianluca Varenni <varenni at netgroup-serv dot polito dot it>
+ Gilbert Hoyek <gil_hoyek at hotmail dot com>
+ Gisle Vanem <gvanem at broadpark dot no>
+ Graeme Hewson <ghewson at cix dot compulink dot co dot uk>
+ Greg Stark <gsstark at mit dot edu>
+ Greg Troxel <gdt at ir dot bbn dot com>
+ Gregor Maier <gregor at net dot in dot tum dot de>
+ Guillaume Pelat <endymion_ at users dot sourceforge dot net>
+ Hagen Paul Pfeifer <hagen at jauu dot net>
+ Hyung Sik Yoon <hsyn at kr dot ibm dot com>
+ Igor Khristophorov <igor at atdot dot org>
+ Jan-Philip Velders <jpv at veldersjes dot net>
+ Jason R. Thorpe <thorpej at netbsd dot org>
+ Javier Achirica <achirica at ttd dot net>
+ Jean Tourrilhes <jt at hpl dot hp dot com>
+ Jean-Louis Charton <Jean-Louis.CHARTON at oikialog dot com>
+ Jefferson Ogata <jogata at nodc dot noaa dot gov>
+ Jesper Peterson <jesper at endace dot com>
+ Joerg Mayer <jmayer at loplof dot de>
+ John Bankier <jbankier at rainfinity dot com>
+ Jon Lindgren <jonl at yubyub dot net>
+ Jon Smirl <jonsmirl at gmail dot com>
+ Juergen Schoenwaelder <schoenw at ibr dot cs dot tu-bs dot de>
+ Jung-uk Kim <jkim at FreeBSD dot org>
+ Kazushi Sugyo <sugyo at pb dot jp dot nec dot com>
+ Klaus Klein <kleink at netbsd dot org>
+ Koryn Grant <koryn at endace dot com>
+ Kris Katterjohn <katterjohn at gmail dot com>
+ Krzysztof Halasa <khc at pm dot waw dot pl>
+ Lorenzo Cavallaro <sullivan at sikurezza dot org>
+ Loris Degioanni <loris at netgroup-serv dot polito dot it>
+ Love Hörnquist-Åstrand <lha at stacken dot kth dot se>
+ Luis MartinGarcia <luis dot mgarc at gmail dot com>
+ Maciej W. Rozycki <macro at ds2 dot pg dot gda dot pl>
+ Marcus Felipe Pereira <marcus at task dot com dot br>
+ Mark C. Brown <mbrown at hp dot com>
+ Mark Pizzolato <List-tcpdump-workers at subscriptions dot pizzolato dot net>
+ Markus Mayer <markus_mayer at sourceforge dot net>
+ Martin Husemann <martin at netbsd dot org>
+ Márton Németh <nm127 at freemail dot hu>
+ Matthew Luckie <mjl at luckie dot org dot nz>
+ Max Laier <max at love2party dot net>
+ Mike Frysinger <vapier at gmail dot com>
+ Mike Kershaw <dragorn at kismetwireless dot net>
+ Mike Wiacek <mike at iroot dot net>
+ Monroe Williams <monroe at pobox dot com>
+ <nvercamm at sourceforge dot net>
+ N. Leiten <nleiten at sourceforge dot net>
+ Nicolas Dade <ndade at nsd dot dyndns dot org>
+ Octavian Cerna <tavy at ylabs dot com>
+ Olaf Kirch <okir at caldera dot de>
+ Ollie Wild <aaw at users dot sourceforge dot net>
+ Onno van der Linden <onno at simplex dot nl>
+ Paolo Abeni <paolo dot abeni at email dot it>
+ Patrick Marie <mycroft at virgaria dot org>
+ Patrick McHardy <kaber at trash not net>
+ Paul Mundt <lethal at linux-sh dot org>
+ Pavel Kankovsky <kan at dcit dot cz>
+ Pawel Pokrywka <publicpp at gmail dot com>
+ Peter Fales <peter at fales-lorenz dot net>
+ Peter Jeremy <peter dot jeremy at alcatel dot com dot au>
+ Peter Volkov <pva at gentoo dot org>
+ Phil Wood <cpw at lanl dot gov>
+ Rafal Maszkowski <rzm at icm dot edu dot pl>
+ <rcb-isis at users dot sourceforge dot net>
+ Richard Stearn <richard at rns-stearn dot demon dot co dot uk>
+ Rick Jones <raj at cup dot hp dot com>
+ Robert Edmonds <stu-42 at sourceforge dot net>
+ Roberto Mariani <jelot-tcpdump at jelot dot it>
+ Romain Francoise <rfrancoise at debian dot org>
+ Sagun Shakya <sagun dot shakya at sun dot com>
+ Scott Barron <sb125499 at ohiou dot edu>
+ Scott Gifford <sgifford at tir dot com>
+ Scott Mcmillan <scott.a.mcmillan at intel dot com>
+ Sebastian Krahmer <krahmer at cs dot uni-potsdam dot de>
+ Sebastien Roy <Sebastien dot Roy at Sun dot COM>
+ Sepherosa Ziehau <sepherosa at gmail dot com>
+ Shaun Clowes <delius at progsoc dot uts dot edu dot au>
+ Solomon Peachy <pizza at shaftnet dot org>
+ Stefan Hudson <hudson at mbay dot net>
+ Stephen Donnelly <stephen at endace dot com>
+ Takashi Yamamoto <yamt at mwd dot biglobe dot ne dot jp>
+ Tanaka Shin-ya <zstanaka at archer dot livedoor dot com>
+ Tobias Poschwatta <posch at sourceforge dot net>
+ Tony Li <tli at procket dot com>
+ Torsten Landschoff <torsten at debian dot org>
+ Uns Lider <unslider at miranda dot org>
+ Uwe Girlich <Uwe dot Girlich at philosys dot de>
+ Wesley Shields <wxs at FreeBSD dot org>
+ Xianjie Zhang <xzhang at cup dot hp dot com>
+ Xin Li <delphij at FreeBSD dot org>
+ Yen Yen Lim
+ Yvan Vanhullebus <vanhu at sourceforge dot net>
+ Yoann Vandoorselaere <yoann at prelude-ids dot org>
The original LBL crew:
- Steve McCanne
- Craig Leres
- Van Jacobson
+ Steve McCanne
+ Craig Leres
+ Van Jacobson
Past maintainers:
- Jun-ichiro itojun Hagino <itojun at iijlab dot net>
+ Jun-ichiro itojun Hagino <itojun at iijlab dot net>
diff --git a/Makefile.in b/Makefile.in
index 5fcfb78..05edb96 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -492,11 +492,7 @@ bpf_filter.o: bpf_filter.c
#
pcap-config: $(srcdir)/pcap-config.in
@rm -f $@ $@.tmp
- sed -e 's|@includedir[@]|$(includedir)|g' \
- -e 's|@libdir[@]|$(libdir)|g' \
- -e 's|@LIBS[@]|$(LIBS)|g' \
- -e 's|@V_RPATH_OPT[@]|$(V_RPATH_OPT)|g' \
- $(srcdir)/pcap-config.in >$@.tmp
+ ./config.status --file=$@.tmp:$<
mv $@.tmp $@
chmod a+x $@
diff --git a/Win32/Src/getaddrinfo.c b/Win32/Src/getaddrinfo.c
index 8e8ad85..ebfe8c2 100644
--- a/Win32/Src/getaddrinfo.c
+++ b/Win32/Src/getaddrinfo.c
@@ -45,6 +45,12 @@
* in ai_flags?
*/
+/*
+ * Mingw64 has its own implementation of getaddrinfo, mingw32 no
+ */
+#ifndef __MINGW64__
+
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -85,7 +91,7 @@ static const char rcsid[] _U_ =
#ifdef NEED_ADDRINFO_H
#include "addrinfo.h"
#ifdef WIN32
-#include "IP6_misc.h"
+#include "ip6_misc.h"
#endif
#endif
@@ -1118,3 +1124,6 @@ find_afd(af)
}
return NULL;
}
+
+
+#endif /*__MING64__*/
diff --git a/config.h.in b/config.h.in
index 688f596..6ea10ad 100644
--- a/config.h.in
+++ b/config.h.in
@@ -52,9 +52,15 @@
/* if libnl exists */
#undef HAVE_LIBNL
+/* if libnl exists and is version 2.x */
+#undef HAVE_LIBNL_2_x
+
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
+/* Define to 1 if you have the <linux/compiler.h> header file. */
+#undef HAVE_LINUX_COMPILER_H
+
/* Define to 1 if you have the <linux/net_tstamp.h> header file. */
#undef HAVE_LINUX_NET_TSTAMP_H
diff --git a/configure b/configure
index bd78b34..675d2c7 100755
--- a/configure
+++ b/configure
@@ -7347,7 +7347,93 @@ fi
if test x$with_libnl != xno ; then
- { echo "$as_me:$LINENO: checking for nl_handle_alloc in -lnl" >&5
+ #
+ # Try libnl 2.x first.
+ #
+ { echo "$as_me:$LINENO: checking for nl_socket_alloc in -lnl" >&5
+echo $ECHO_N "checking for nl_socket_alloc in -lnl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_nl_nl_socket_alloc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char nl_socket_alloc ();
+int
+main ()
+{
+return nl_socket_alloc ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_nl_nl_socket_alloc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_nl_nl_socket_alloc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_nl_nl_socket_alloc" >&5
+echo "${ECHO_T}$ac_cv_lib_nl_nl_socket_alloc" >&6; }
+if test $ac_cv_lib_nl_nl_socket_alloc = yes; then
+
+ #
+ # Yes, we have libnl 2.x.
+ #
+ LIBS="-lnl-genl -lnl $LIBS"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBNL 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBNL_2_x 1
+_ACEOF
+
+
+else
+
+ #
+ # No, we don't; do we have libnl 1.x?
+ #
+ { echo "$as_me:$LINENO: checking for nl_handle_alloc in -lnl" >&5
echo $ECHO_N "checking for nl_handle_alloc in -lnl... $ECHO_C" >&6; }
if test "${ac_cv_lib_nl_nl_handle_alloc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7409,18 +7495,30 @@ fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_nl_nl_handle_alloc" >&5
echo "${ECHO_T}$ac_cv_lib_nl_nl_handle_alloc" >&6; }
if test $ac_cv_lib_nl_nl_handle_alloc = yes; then
- LIBS="-lnl $LIBS"
+
+ #
+ # Yes.
+ #
+ LIBS="-lnl $LIBS"
cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBNL 1
_ACEOF
+
else
- if test x$with_libnl = xyes ; then
- { { echo "$as_me:$LINENO: error: libnl support requested but libnl not found" >&5
+
+ #
+ # No, we don't have libnl at all.
+ #
+ if test x$with_libnl = xyes ; then
+ { { echo "$as_me:$LINENO: error: libnl support requested but libnl not found" >&5
echo "$as_me: error: libnl support requested but libnl not found" >&2;}
{ (exit 1); exit 1; }; }
- fi
+ fi
+
+fi
+
fi
@@ -10329,6 +10427,213 @@ _ACEOF
{ echo "$as_me:$LINENO: Device for USB sniffing is /dev/$ac_usb_dev_name" >&5
echo "$as_me: Device for USB sniffing is /dev/$ac_usb_dev_name" >&6;}
+ #
+ # Do we have a version of <linux/compiler.h> available?
+ # If so, we might need it for <linux/usbdevice_fs.h>.
+ #
+
+for ac_header in linux/compiler.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ if test "$ac_cv_header_linux_compiler_h" = yes; then
+ #
+ # Yes - include it when testing for <linux/usbdevice_fs.h>.
+ #
+
+for ac_header in linux/usbdevice_fs.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <linux/compiler.h>
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ else
for ac_header in linux/usbdevice_fs.h
do
@@ -10469,6 +10774,7 @@ fi
done
+ fi
if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
#
# OK, does it define bRequestType? Older versions of the kernel
@@ -10492,6 +10798,9 @@ $ac_includes_default
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif
+#ifdef HAVE_LINUX_COMPILER_H
+#include <linux/compiler.h>
+#endif
# include <linux/usbdevice_fs.h>
int
main ()
diff --git a/configure.in b/configure.in
index 16e0299..cd8ed95 100644
--- a/configure.in
+++ b/configure.in
@@ -445,13 +445,39 @@ linux)
with_libnl=$withval,,)
if test x$with_libnl != xno ; then
- AC_CHECK_LIB(nl, nl_handle_alloc,
- LIBS="-lnl $LIBS"
- AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]),
- if test x$with_libnl = xyes ; then
- AC_MSG_ERROR([libnl support requested but libnl not found])
- fi
- )
+ #
+ # Try libnl 2.x first.
+ #
+ AC_CHECK_LIB(nl, nl_socket_alloc,
+ [
+ #
+ # Yes, we have libnl 2.x.
+ #
+ LIBS="-lnl-genl -lnl $LIBS"
+ AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
+ AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
+ ],
+ [
+ #
+ # No, we don't; do we have libnl 1.x?
+ #
+ AC_CHECK_LIB(nl, nl_handle_alloc,
+ [
+ #
+ # Yes.
+ #
+ LIBS="-lnl $LIBS"
+ AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
+ ],
+ [
+ #
+ # No, we don't have libnl at all.
+ #
+ if test x$with_libnl = xyes ; then
+ AC_MSG_ERROR([libnl support requested but libnl not found])
+ fi
+ ])
+ ])
fi
AC_LBL_TPACKET_STATS
@@ -1365,7 +1391,19 @@ linux*)
fi
AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
- AC_CHECK_HEADERS(linux/usbdevice_fs.h)
+ #
+ # Do we have a version of <linux/compiler.h> available?
+ # If so, we might need it for <linux/usbdevice_fs.h>.
+ #
+ AC_CHECK_HEADERS(linux/compiler.h)
+ if test "$ac_cv_header_linux_compiler_h" = yes; then
+ #
+ # Yes - include it when testing for <linux/usbdevice_fs.h>.
+ #
+ AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
+ else
+ AC_CHECK_HEADERS(linux/usbdevice_fs.h)
+ fi
if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
#
# OK, does it define bRequestType? Older versions of the kernel
@@ -1380,6 +1418,9 @@ AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif
+#ifdef HAVE_LINUX_COMPILER_H
+#include <linux/compiler.h>
+#endif
# include <linux/usbdevice_fs.h>],
[u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
diff --git a/gencode.c b/gencode.c
index 5b113cf..a105138 100644
--- a/gencode.c
+++ b/gencode.c
@@ -47,7 +47,7 @@ static const char rcsid[] _U_ =
* XXX - why was this included even on UNIX?
*/
#ifdef __MINGW32__
-#include "IP6_misc.h"
+#include "ip6_misc.h"
#endif
#ifndef WIN32
diff --git a/inet.c b/inet.c
index 642ffb0..3c09316 100644
--- a/inet.c
+++ b/inet.c
@@ -881,8 +881,10 @@ pcap_lookupdev(errbuf)
*/
while(NAdapts--)
{
- strcpy((char*)tUstr, tAstr);
- (char*)tUstr += strlen(tAstr) + 1;;
+ char* tmp = (char*)tUstr;
+ strcpy(tmp, tAstr);
+ tmp += strlen(tAstr) + 1;
+ tUstr = (WCHAR*)tmp;
tAstr += strlen(tAstr) + 1;
}
diff --git a/pcap-common.c b/pcap-common.c
index 5f6a929..3989dfc 100644
--- a/pcap-common.c
+++ b/pcap-common.c
@@ -735,6 +735,24 @@ static const char rcsid[] _U_ =
*/
#define LINKTYPE_IEEE802_15_4_NOFCS 230
+/*
+ * Raw D-Bus:
+ *
+ * http://www.freedesktop.org/wiki/Software/dbus
+ *
+ * messages:
+ *
+ * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
+ *
+ * starting with the endianness flag, followed by the message type, etc.,
+ * but without the authentication handshake before the message sequence:
+ *
+ * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
+ *
+ * Requested by Martin Vidner <martin@vidner.net>.
+ */
+#define LINKTYPE_DBUS 231
+
static struct linktype_map {
int dlt;
@@ -1084,6 +1102,9 @@ static struct linktype_map {
/* IEEE 802.15.4 exactly as it appears in the spec, without FCS */
{ DLT_IEEE802_15_4_NOFCS, LINKTYPE_IEEE802_15_4_NOFCS },
+ /* D-Bus messages */
+ { DLT_DBUS, LINKTYPE_DBUS },
+
{ -1, -1 }
};
diff --git a/pcap-config.in b/pcap-config.in
index 37526d7..206be3b 100644
--- a/pcap-config.in
+++ b/pcap-config.in
@@ -4,6 +4,13 @@
# Script to give the appropriate compiler flags and linker flags
# to use when building code that uses libpcap.
#
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+includedir="@includedir@"
+libdir="@libdir@"
+V_RPATH_OPT="@V_RPATH_OPT@"
+LIBS="@LIBS@"
+
static=0
show_cflags=0
show_libs=0
@@ -29,14 +36,14 @@ do
esac
shift
done
-if [ "@V_RPATH_OPT@" != "" ]
+if [ "$V_RPATH_OPT" != "" ]
then
#
# If libdir isn't /usr/lib, add it to the run-time linker path.
#
- if [ "@libdir@" != "/usr/lib" ]
+ if [ "$libdir" != "/usr/lib" ]
then
- RPATH=@V_RPATH_OPT@@libdir@
+ RPATH=$V_RPATH_OPT$libdir
fi
fi
if [ "$static" = 1 ]
@@ -47,19 +54,19 @@ then
#
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then
- echo "-I@includedir@ -L@libdir@ -lpcap @LIBS@"
+ echo "-I$includedir -L$libdir -lpcap $LIBS"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then
- echo "-I@includedir@ -L@libdir@ @LIBS@"
+ echo "-I$includedir -L$libdir $LIBS"
elif [ "$show_cflags" = 1 ]
then
- echo "-I@includedir@"
+ echo "-I$includedir"
elif [ "$show_libs" = 1 ]
then
- echo "-L@libdir@ -lpcap @LIBS@"
+ echo "-L$libdir -lpcap $LIBS"
elif [ "$show_additional_libs" = 1 ]
then
- echo "@LIBS@"
+ echo "$LIBS"
fi
else
#
@@ -68,15 +75,15 @@ else
#
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then
- echo "-I@includedir@ -L@libdir@ $RPATH -lpcap"
+ echo "-I$includedir -L$libdir $RPATH -lpcap"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then
- echo "-I@includedir@"
+ echo "-I$includedir"
elif [ "$show_cflags" = 1 ]
then
- echo "-I@includedir@"
+ echo "-I$includedir"
elif [ "$show_libs" = 1 ]
then
- echo "-L@libdir@ $RPATH -lpcap"
+ echo "-L$libdir $RPATH -lpcap"
fi
fi
diff --git a/pcap-linux.c b/pcap-linux.c
index 9cdc0bf..8b4409e 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -537,8 +537,41 @@ get_mac80211_phydev(pcap_t *handle, const char *device, char *phydev_path,
return 1;
}
+#ifdef HAVE_LIBNL_2_x
+#define get_nl_errmsg nl_geterror
+#else
+/* libnl 2.x compatibility code */
+
+#define nl_sock nl_handle
+
+static inline struct nl_handle *
+nl_socket_alloc(void)
+{
+ return nl_handle_alloc();
+}
+
+static inline void
+nl_socket_free(struct nl_handle *h)
+{
+ nl_handle_destroy(h);
+}
+
+#define get_nl_errmsg strerror
+
+static inline int
+__genl_ctrl_alloc_cache(struct nl_handle *h, struct nl_cache **cache)
+{
+ struct nl_cache *tmp = genl_ctrl_alloc_cache(h);
+ if (!tmp)
+ return -ENOMEM;
+ *cache = tmp;
+ return 0;
+}
+#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
+#endif /* !HAVE_LIBNL_2_x */
+
struct nl80211_state {
- struct nl_handle *nl_handle;
+ struct nl_sock *nl_sock;
struct nl_cache *nl_cache;
struct genl_family *nl80211;
};
@@ -546,23 +579,26 @@ struct nl80211_state {
static int
nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device)
{
- state->nl_handle = nl_handle_alloc();
- if (!state->nl_handle) {
+ int err;
+
+ state->nl_sock = nl_socket_alloc();
+ if (!state->nl_sock) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: failed to allocate netlink handle", device);
return PCAP_ERROR;
}
- if (genl_connect(state->nl_handle)) {
+ if (genl_connect(state->nl_sock)) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: failed to connect to generic netlink", device);
goto out_handle_destroy;
}
- state->nl_cache = genl_ctrl_alloc_cache(state->nl_handle);
- if (!state->nl_cache) {
+ err = genl_ctrl_alloc_cache(state->nl_sock, &state->nl_cache);
+ if (err < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
- "%s: failed to allocate generic netlink cache", device);
+ "%s: failed to allocate generic netlink cache: %s",
+ device, get_nl_errmsg(-err));
goto out_handle_destroy;
}
@@ -578,7 +614,7 @@ nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device)
out_cache_free:
nl_cache_free(state->nl_cache);
out_handle_destroy:
- nl_handle_destroy(state->nl_handle);
+ nl_socket_free(state->nl_sock);
return PCAP_ERROR;
}
@@ -587,7 +623,7 @@ nl80211_cleanup(struct nl80211_state *state)
{
genl_family_put(state->nl80211);
nl_cache_free(state->nl_cache);
- nl_handle_destroy(state->nl_handle);
+ nl_socket_free(state->nl_sock);
}
static int
@@ -615,12 +651,19 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, mondevice);
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_MONITOR);
- err = nl_send_auto_complete(state->nl_handle, msg);
+ err = nl_send_auto_complete(state->nl_sock, msg);
if (err < 0) {
+#ifdef HAVE_LIBNL_2_x
+ if (err == -NLE_FAILURE) {
+#else
if (err == -ENFILE) {
+#endif
/*
* Device not available; our caller should just
- * keep trying.
+ * keep trying. (libnl 2.x maps ENFILE to
+ * NLE_FAILURE; it can also map other errors
+ * to that, but there's not much we can do
+ * about that.)
*/
nlmsg_free(msg);
return 0;
@@ -631,17 +674,24 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
*/
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: nl_send_auto_complete failed adding %s interface: %s",
- device, mondevice, strerror(-err));
+ device, mondevice, get_nl_errmsg(-err));
nlmsg_free(msg);
return PCAP_ERROR;
}
}
- err = nl_wait_for_ack(state->nl_handle);
+ err = nl_wait_for_ack(state->nl_sock);
if (err < 0) {
+#ifdef HAVE_LIBNL_2_x
+ if (err == -NLE_FAILURE) {
+#else
if (err == -ENFILE) {
+#endif
/*
* Device not available; our caller should just
- * keep trying.
+ * keep trying. (libnl 2.x maps ENFILE to
+ * NLE_FAILURE; it can also map other errors
+ * to that, but there's not much we can do
+ * about that.)
*/
nlmsg_free(msg);
return 0;
@@ -652,7 +702,7 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
*/
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: nl_wait_for_ack failed adding %s interface: %s",
- device, mondevice, strerror(-err));
+ device, mondevice, get_nl_errmsg(-err));
nlmsg_free(msg);
return PCAP_ERROR;
}
@@ -695,47 +745,21 @@ del_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
0, NL80211_CMD_DEL_INTERFACE, 0);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
- err = nl_send_auto_complete(state->nl_handle, msg);
+ err = nl_send_auto_complete(state->nl_sock, msg);
if (err < 0) {
- if (err == -ENFILE) {
- /*
- * Device not available; our caller should just
- * keep trying.
- */
- nlmsg_free(msg);
- return 0;
- } else {
- /*
- * Real failure, not just "that device is not
- * available.
- */
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
- "%s: nl_send_auto_complete failed deleting %s interface: %s",
- device, mondevice, strerror(-err));
- nlmsg_free(msg);
- return PCAP_ERROR;
- }
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+ "%s: nl_send_auto_complete failed deleting %s interface: %s",
+ device, mondevice, get_nl_errmsg(-err));
+ nlmsg_free(msg);
+ return PCAP_ERROR;
}
- err = nl_wait_for_ack(state->nl_handle);
+ err = nl_wait_for_ack(state->nl_sock);
if (err < 0) {
- if (err == -ENFILE) {
- /*
- * Device not available; our caller should just
- * keep trying.
- */
- nlmsg_free(msg);
- return 0;
- } else {
- /*
- * Real failure, not just "that device is not
- * available.
- */
- snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
- "%s: nl_wait_for_ack failed adding %s interface: %s",
- device, mondevice, strerror(-err));
- nlmsg_free(msg);
- return PCAP_ERROR;
- }
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+ "%s: nl_wait_for_ack failed adding %s interface: %s",
+ device, mondevice, get_nl_errmsg(-err));
+ nlmsg_free(msg);
+ return PCAP_ERROR;
}
/*
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c
index daaa900..f1b430c 100644
--- a/pcap-usb-linux.c
+++ b/pcap-usb-linux.c
@@ -61,8 +61,15 @@ static const char rcsid[] _U_ =
#include <sys/ioctl.h>
#include <sys/mman.h>
#ifdef HAVE_LINUX_USBDEVICE_FS_H
+/*
+ * We might need <linux/compiler.h> to define __user for
+ * <linux/usbdevice_fs.h>.
+ */
+#ifdef HAVE_LINUX_COMPILER_H
+#include <linux/compiler.h>
+#endif /* HAVE_LINUX_COMPILER_H */
#include <linux/usbdevice_fs.h>
-#endif
+#endif /* HAVE_LINUX_USBDEVICE_FS_H */
#define USB_IFACE "usbmon"
#define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon"
diff --git a/pcap-win32.c b/pcap-win32.c
index 0e2201e..fc6eed1 100644
--- a/pcap-win32.c
+++ b/pcap-win32.c
@@ -39,7 +39,12 @@ static const char rcsid[] _U_ =
#include <pcap-int.h>
#include <Packet32.h>
#ifdef __MINGW32__
+#ifdef __MINGW64__
+#include <ntddndis.h>
+#else /*__MINGW64__*/
+#include <ddk/ntddndis.h>
#include <ddk/ndis.h>
+#endif /*__MINGW64__*/
#else /*__MINGW32__*/
#include <ntddndis.h>
#endif /*__MINGW32__*/
diff --git a/pcap.c b/pcap.c
index 3db3320..411ce0a 100644
--- a/pcap.c
+++ b/pcap.c
@@ -57,7 +57,7 @@ static const char rcsid[] _U_ =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__MINGW32__)
#include <unistd.h>
#endif
#include <fcntl.h>
diff --git a/pcap/bpf.h b/pcap/bpf.h
index 938a62a..18464b9 100644
--- a/pcap/bpf.h
+++ b/pcap/bpf.h
@@ -970,9 +970,27 @@ struct bpf_version {
#define DLT_IEEE802_15_4_NOFCS 230
/*
+ * Raw D-Bus:
+ *
+ * http://www.freedesktop.org/wiki/Software/dbus
+ *
+ * messages:
+ *
+ * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
+ *
+ * starting with the endianness flag, followed by the message type, etc.,
+ * but without the authentication handshake before the message sequence:
+ *
+ * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
+ *
+ * Requested by Martin Vidner <martin@vidner.net>.
+ */
+#define DLT_DBUS 231
+
+/*
* DECT
*/
-#define DLT_DECT_LINUX 231
+#define DLT_DECT_LINUX 232
/*
* DLT and savefile link type values are split into a class and
diff --git a/scanner.l b/scanner.l
index a061a7e..c8e2d20 100644
--- a/scanner.l
+++ b/scanner.l
@@ -54,7 +54,7 @@ static const char rcsid[] _U_ =
#include <pcap-stdinc.h>
#ifdef __MINGW32__
-#include "IP6_misc.h"
+#include "ip6_misc.h"
#endif
#else /* WIN32 */
#include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */
diff --git a/sf-pcap-ng.c b/sf-pcap-ng.c
index 9049991..1554320 100644
--- a/sf-pcap-ng.c
+++ b/sf-pcap-ng.c
@@ -1053,7 +1053,7 @@ found:
/*
* Is the interface ID an interface we know?
*/
- if (interface_id > p->sf.ifcount) {
+ if (interface_id >= p->sf.ifcount) {
/*
* Yes. Fail.
*/