mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Update libpcap to 1.7.3, partially addressing #34
This commit is contained in:
@@ -1,3 +1,50 @@
|
|||||||
|
Friday Apr. 10, 2015 guy@alum.mit.edu
|
||||||
|
Summary for 1.7.3 libpcap release
|
||||||
|
Work around a Linux bonding driver bug.
|
||||||
|
|
||||||
|
Thursday Feb. 12, 2015 guy@alum.mit.edu/mcr@sandelman.ca
|
||||||
|
Summary for 1.7.2 libpcap release
|
||||||
|
Support for filtering Geneve encapsulated packets.
|
||||||
|
Generalize encapsulation handling, fixing some bugs.
|
||||||
|
Don't add null addresses to address lists.
|
||||||
|
Add pcap_dump_open_append() to open for appending.
|
||||||
|
Fix the swapping of isochronous descriptors in Linux USB.
|
||||||
|
Attempt to handle TPACKET_V1 with 32-bit userland and 64-bit kernel.
|
||||||
|
|
||||||
|
Wednesday Nov. 12, 2014 guy@alum.mit.edu/mcr@sandelman.ca
|
||||||
|
Summary for 1.7.0 libpcap release
|
||||||
|
Fix handling of zones for BPF on Solaris
|
||||||
|
new DLT for ZWAVE
|
||||||
|
clarifications for read timeouts.
|
||||||
|
Use BPF extensions in compiled filters, fixing VLAN filters
|
||||||
|
some fixes to compilation without stdint.h
|
||||||
|
EBUSY can now be returned by SNFv3 code.
|
||||||
|
Fix the range checks in BPF loads
|
||||||
|
Various DAG fixes.
|
||||||
|
Various Linux fixes.
|
||||||
|
|
||||||
|
Monday Aug. 12, 2014 guy@alum.mit.edu
|
||||||
|
Summary for 1.6.2 libpcap release
|
||||||
|
Don't crash on filters testing a non-existent link-layer type
|
||||||
|
field.
|
||||||
|
Fix sending in non-blocking mode on Linux with memory-mapped
|
||||||
|
capture.
|
||||||
|
Fix timestamps when reading pcap-ng files on big-endian
|
||||||
|
machines.
|
||||||
|
|
||||||
|
Saturday Jul. 19, 2014 mcr@sandelman.ca
|
||||||
|
Summary for 1.6.1 libpcap release
|
||||||
|
some fixes for the any device
|
||||||
|
changes for how --enable-XXX (--enable-sniffing, --enable-can) works
|
||||||
|
|
||||||
|
Wednesday Jul. 2, 2014 mcr@sandelman.ca
|
||||||
|
Summary for 1.6.0 libpcap release
|
||||||
|
Don't support D-Bus sniffing on OS X
|
||||||
|
fixes for byte order issues with NFLOG captures
|
||||||
|
Handle using cooked mode for DLT_NETLINK in activate_new().
|
||||||
|
on platforms where you can not capture on down interfaces, do not list them
|
||||||
|
but: do list interfaces which are down, if you can capture on them!
|
||||||
|
|
||||||
Wednesday December 18, 2013 guy@alum.mit.edu
|
Wednesday December 18, 2013 guy@alum.mit.edu
|
||||||
Summary for 1.5.3 libpcap release
|
Summary for 1.5.3 libpcap release
|
||||||
Don't let packets that don't match the current filter get to the
|
Don't let packets that don't match the current filter get to the
|
||||||
@@ -244,7 +291,7 @@ Mon. October 27, 2008. ken@netfunctional.ca. Summary for 1.0.0 libpcap rele
|
|||||||
DLT: Add JUNIPER_ST
|
DLT: Add JUNIPER_ST
|
||||||
802.15.4 support
|
802.15.4 support
|
||||||
Variable length 802.11 header support
|
Variable length 802.11 header support
|
||||||
X2E data type support
|
X2E data type support
|
||||||
SITA ACN Interface support - see README.sita
|
SITA ACN Interface support - see README.sita
|
||||||
Support for memory-mapped capture on Linux
|
Support for memory-mapped capture on Linux
|
||||||
Support for zerocopy BPF on platforms that support it
|
Support for zerocopy BPF on platforms that support it
|
||||||
@@ -256,7 +303,7 @@ Mon. October 27, 2008. ken@netfunctional.ca. Summary for 1.0.0 libpcap rele
|
|||||||
can print better diagnostic information
|
can print better diagnostic information
|
||||||
Return PCAP_ERROR_PERM_DENIED if we don't have permission to open a device, so
|
Return PCAP_ERROR_PERM_DENIED if we don't have permission to open a device, so
|
||||||
applications can tell the user they need to go play with permissions
|
applications can tell the user they need to go play with permissions
|
||||||
On Linux, ignore ENETDOWN so we can continue to capture packets if the
|
On Linux, ignore ENETDOWN so we can continue to capture packets if the
|
||||||
interface goes down and comes back up again.
|
interface goes down and comes back up again.
|
||||||
On Linux, support new tpacket frame headers (2.6.27+)
|
On Linux, support new tpacket frame headers (2.6.27+)
|
||||||
On Mac OS X, add scripts for changing permissions on /dev/bpf* and launchd plist
|
On Mac OS X, add scripts for changing permissions on /dev/bpf* and launchd plist
|
||||||
@@ -269,14 +316,14 @@ Mon. September 10, 2007. ken@xelerance.com. Summary for 0.9.8 libpcap relea
|
|||||||
Change build process to put public libpcap headers into pcap subir
|
Change build process to put public libpcap headers into pcap subir
|
||||||
DLT: Add value for IPMI IPMB packets
|
DLT: Add value for IPMI IPMB packets
|
||||||
DLT: Add value for u10 Networks boards
|
DLT: Add value for u10 Networks boards
|
||||||
Require <net/pfvar.h> for pf definitions - allows reading of pflog formatted
|
Require <net/pfvar.h> for pf definitions - allows reading of pflog formatted
|
||||||
libpcap files on an OS other than where the file was generated
|
libpcap files on an OS other than where the file was generated
|
||||||
|
|
||||||
Wed. April 25, 2007. ken@xelerance.com. Summary for 0.9.6 libpcap release
|
Wed. April 25, 2007. ken@xelerance.com. Summary for 0.9.6 libpcap release
|
||||||
|
|
||||||
Put the public libpcap headers into a pcap subdirectory in both the
|
Put the public libpcap headers into a pcap subdirectory in both the
|
||||||
source directory and the target include directory, and have include
|
source directory and the target include directory, and have include
|
||||||
files at the top-level directory to include those headers, for
|
files at the top-level directory to include those headers, for
|
||||||
backwards compatibility.
|
backwards compatibility.
|
||||||
Add Bluetooth support
|
Add Bluetooth support
|
||||||
Add USB capturing support on Linux
|
Add USB capturing support on Linux
|
||||||
@@ -284,30 +331,30 @@ Wed. April 25, 2007. ken@xelerance.com. Summary for 0.9.6 libpcap release
|
|||||||
Add support for new FreeBSD BIOCSDIRECTION ioctl
|
Add support for new FreeBSD BIOCSDIRECTION ioctl
|
||||||
Add additional filter operations for 802.11 frame types
|
Add additional filter operations for 802.11 frame types
|
||||||
Add support for filtering on MTP2 frame types
|
Add support for filtering on MTP2 frame types
|
||||||
Propagate some changes from the main branch, so the x.9 branch has
|
Propagate some changes from the main branch, so the x.9 branch has
|
||||||
all the DLT_ and LINKTYPE_ values that the main branch does
|
all the DLT_ and LINKTYPE_ values that the main branch does
|
||||||
Reserved a DLT_ and SAVEFILE_ value for PPI (Per Packet Info)
|
Reserved a DLT_ and SAVEFILE_ value for PPI (Per Packet Info)
|
||||||
encapsulated packets
|
encapsulated packets
|
||||||
Add LINKTYPE_ for IEEE 802.15.4, with address fields padded as done
|
Add LINKTYPE_ for IEEE 802.15.4, with address fields padded as done
|
||||||
by Linux drivers
|
by Linux drivers
|
||||||
Add LINKTYPE_ value corresponding to DLT_IEEE802_16_MAC_CPS.
|
Add LINKTYPE_ value corresponding to DLT_IEEE802_16_MAC_CPS.
|
||||||
Add DLT for IEEE 802.16 (WiMAX) MAC Common Part Sublayer
|
Add DLT for IEEE 802.16 (WiMAX) MAC Common Part Sublayer
|
||||||
Add DLT for Bluetooth HCI UART transport layer
|
Add DLT for Bluetooth HCI UART transport layer
|
||||||
When building a shared library, build with "-fPIC" on Linux to support x86_64
|
When building a shared library, build with "-fPIC" on Linux to support x86_64
|
||||||
Link with "$(CC) -shared" rather than "ld -shared" when building a
|
Link with "$(CC) -shared" rather than "ld -shared" when building a
|
||||||
".so" shared library
|
".so" shared library
|
||||||
Add support for autoconf 2.60
|
Add support for autoconf 2.60
|
||||||
Fixes to discard unread packets when changing filters
|
Fixes to discard unread packets when changing filters
|
||||||
Changes to handle name changes in the DAG library resulting from
|
Changes to handle name changes in the DAG library resulting from
|
||||||
switching to libtool.
|
switching to libtool.
|
||||||
Add support for new DAG ERF types.
|
Add support for new DAG ERF types.
|
||||||
Add an explicit "-ldag" when building the shared library, so the DAG
|
Add an explicit "-ldag" when building the shared library, so the DAG
|
||||||
library dependency is explicit.
|
library dependency is explicit.
|
||||||
Mac OSX fixes for dealing with "wlt" devices
|
Mac OSX fixes for dealing with "wlt" devices
|
||||||
Fixes in add_or_find_if() & pcap_findalldevs() to optimize generating
|
Fixes in add_or_find_if() & pcap_findalldevs() to optimize generating
|
||||||
device lists
|
device lists
|
||||||
Fixed a bug in pcap_open_live(). The return value of PacketSetHwFilter
|
Fixed a bug in pcap_open_live(). The return value of PacketSetHwFilter
|
||||||
was not checked.
|
was not checked.
|
||||||
|
|
||||||
Tue. September 19, 2006. ken@xelerance.com. Summary for 0.9.5 libpcap release
|
Tue. September 19, 2006. ken@xelerance.com. Summary for 0.9.5 libpcap release
|
||||||
|
|
||||||
@@ -319,19 +366,19 @@ Tue. September 19, 2006. ken@xelerance.com. Summary for 0.9.5 libpcap release
|
|||||||
OP_PACKET now matches the beginning of the packet, instead of
|
OP_PACKET now matches the beginning of the packet, instead of
|
||||||
beginning+link-layer
|
beginning+link-layer
|
||||||
Add DLT/LINKTYPE for carrying FRF.16 Multi-link Frame Relay
|
Add DLT/LINKTYPE for carrying FRF.16 Multi-link Frame Relay
|
||||||
Fix allocation of buffer for list of link-layer types
|
Fix allocation of buffer for list of link-layer types
|
||||||
Added a new DLT and LINKTYPE value for ARINC 653 Interpartition Communcation Messages
|
Added a new DLT and LINKTYPE value for ARINC 653 Interpartition Communcation Messages
|
||||||
Fixed a typo in a DLT value: it should start with DLT_ and not LINKTYPE_
|
Fixed a typo in a DLT value: it should start with DLT_ and not LINKTYPE_
|
||||||
Redefined DLT_CAN20B and LINKTYPE_CAN20B as #190 (as this is the right value for CAN).
|
Redefined DLT_CAN20B and LINKTYPE_CAN20B as #190 (as this is the right value for CAN).
|
||||||
Added definition for DLT_A429 and LINKTYPE_A429 as #184.
|
Added definition for DLT_A429 and LINKTYPE_A429 as #184.
|
||||||
Added a new DLT and LINKTYPE value for CAN v2.0B frames.
|
Added a new DLT and LINKTYPE value for CAN v2.0B frames.
|
||||||
Add support for DLT_JUNIPER_VP.
|
Add support for DLT_JUNIPER_VP.
|
||||||
Don't double-count received packets on Linux systems that
|
Don't double-count received packets on Linux systems that
|
||||||
support the PACKET_STATISTICS getsockopt() argument on
|
support the PACKET_STATISTICS getsockopt() argument on
|
||||||
PF_PACKET sockets.
|
PF_PACKET sockets.
|
||||||
Add support for DLT_IEEE802_11 and DLT_IEEE802_11_RADIO link
|
Add support for DLT_IEEE802_11 and DLT_IEEE802_11_RADIO link
|
||||||
layers in Windows
|
layers in Windows
|
||||||
Add support to build libpcap.lib and wpcap.dll under Cygnus and
|
Add support to build libpcap.lib and wpcap.dll under Cygnus and
|
||||||
MingW32.
|
MingW32.
|
||||||
|
|
||||||
Mon. September 5, 2005. ken@xelerance.com. Summary for 0.9.4 libpcap release
|
Mon. September 5, 2005. ken@xelerance.com. Summary for 0.9.4 libpcap release
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ This file lists people who have contributed to libpcap:
|
|||||||
|
|
||||||
The current maintainers:
|
The current maintainers:
|
||||||
Bill Fenner <fenner at research dot att dot com>
|
Bill Fenner <fenner at research dot att dot com>
|
||||||
Denis Ovsienko <infrastation at yandex dot ru>
|
Denis Ovsienko <denis at ovsienko dot info>
|
||||||
Fulvio Risso <risso at polito dot it>
|
Fulvio Risso <risso at polito dot it>
|
||||||
Guy Harris <guy at alum dot mit dot edu>
|
Guy Harris <guy at alum dot mit dot edu>
|
||||||
Hannes Gredler <hannes at juniper dot net>
|
Hannes Gredler <hannes at juniper dot net>
|
||||||
Michael Richardson <mcr at sandelman dot ottawa dot on dot ca>
|
Michael Richardson <mcr at sandelman dot ottawa dot on dot ca>
|
||||||
|
Francois-Xavier Le Bail <fx dot lebail at yahoo dot com>
|
||||||
|
|
||||||
Additional people who have contributed patches:
|
Additional people who have contributed patches:
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ Additional people who have contributed patches:
|
|||||||
David Young <dyoung at ojctech dot com>
|
David Young <dyoung at ojctech dot com>
|
||||||
Dean Gaudet <dean at arctic dot org>
|
Dean Gaudet <dean at arctic dot org>
|
||||||
dhruv <rsrivat at sourceforge dot net>
|
dhruv <rsrivat at sourceforge dot net>
|
||||||
Don Ebright <Don dot Ebright at compuware dot com>
|
Don Ebright <Don dot Ebright at compuware dot com>
|
||||||
Dug Song <dugsong at monkey dot org>
|
Dug Song <dugsong at monkey dot org>
|
||||||
Dustin Spicuzza <dustin at virtualroadside dot com>
|
Dustin Spicuzza <dustin at virtualroadside dot com>
|
||||||
dzejarczech <dzejarczech at sourceforge dot net>
|
dzejarczech <dzejarczech at sourceforge dot net>
|
||||||
@@ -83,6 +84,7 @@ Additional people who have contributed patches:
|
|||||||
Jefferson Ogata <jogata at nodc dot noaa dot gov>
|
Jefferson Ogata <jogata at nodc dot noaa dot gov>
|
||||||
Jesper Dangaard Brouer <hawk at comx dot dk>
|
Jesper Dangaard Brouer <hawk at comx dot dk>
|
||||||
Jesper Peterson <jesper at endace dot com>
|
Jesper Peterson <jesper at endace dot com>
|
||||||
|
Jesse Gross <jesse at nicira dot com>
|
||||||
Jiri Slaby <jirislaby at gmail dot com>
|
Jiri Slaby <jirislaby at gmail dot com>
|
||||||
Joerg Mayer <jmayer at loplof dot de>
|
Joerg Mayer <jmayer at loplof dot de>
|
||||||
John Bankier <jbankier at rainfinity dot com>
|
John Bankier <jbankier at rainfinity dot com>
|
||||||
@@ -105,13 +107,14 @@ Additional people who have contributed patches:
|
|||||||
Mansour Behabadi <mansour at oxplot dot com>
|
Mansour Behabadi <mansour at oxplot dot com>
|
||||||
Marcus Felipe Pereira <marcus at task dot com dot br>
|
Marcus Felipe Pereira <marcus at task dot com dot br>
|
||||||
Mark C. Brown <mbrown at hp dot com>
|
Mark C. Brown <mbrown at hp dot com>
|
||||||
|
Mark Johnston <markjdb at gmail dot com>
|
||||||
Mark Pizzolato <List-tcpdump-workers at subscriptions dot pizzolato dot net>
|
Mark Pizzolato <List-tcpdump-workers at subscriptions dot pizzolato dot net>
|
||||||
Markus Mayer <markus_mayer at sourceforge dot net>
|
Markus Mayer <markus_mayer at sourceforge dot net>
|
||||||
Martin Husemann <martin at netbsd dot org>
|
Martin Husemann <martin at netbsd dot org>
|
||||||
Márton Németh <nm127 at freemail dot hu>
|
Márton Németh <nm127 at freemail dot hu>
|
||||||
Matthew Luckie <mjl at luckie dot org dot nz>
|
Matthew Luckie <mjl at luckie dot org dot nz>
|
||||||
Max Laier <max at love2party dot net>
|
Max Laier <max at love2party dot net>
|
||||||
Michal Labedzki
|
Michal Labedzki <michal dot labedzki at tieto dot com>
|
||||||
Michal Sekletar <msekleta at redhat dot com>
|
Michal Sekletar <msekleta at redhat dot com>
|
||||||
Mike Frysinger <vapier at gmail dot com>
|
Mike Frysinger <vapier at gmail dot com>
|
||||||
Mike Kershaw <dragorn at kismetwireless dot net>
|
Mike Kershaw <dragorn at kismetwireless dot net>
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@(#) $Header: /tcpdump/master/libpcap/INSTALL.txt,v 1.29 2008-06-12 20:21:51 guy Exp $ (LBL)
|
|
||||||
|
|
||||||
To build libpcap, run "./configure" (a shell script). The configure
|
To build libpcap, run "./configure" (a shell script). The configure
|
||||||
script will determine your system attributes and generate an
|
script will determine your system attributes and generate an
|
||||||
appropriate Makefile from Makefile.in. Next run "make". If everything
|
appropriate Makefile from Makefile.in. Next run "make". If everything
|
||||||
@@ -31,19 +29,14 @@ where the configure scripts fails to detect it.
|
|||||||
|
|
||||||
You will need an ANSI C compiler to build libpcap. The configure script
|
You will need an ANSI C compiler to build libpcap. The configure script
|
||||||
will abort if your compiler is not ANSI compliant. If this happens, use
|
will abort if your compiler is not ANSI compliant. If this happens, use
|
||||||
the GNU C compiler, available via anonymous ftp:
|
the generally available GNU C compiler (GCC).
|
||||||
|
|
||||||
ftp://ftp.gnu.org/pub/gnu/gcc/
|
|
||||||
|
|
||||||
If you use flex, you must use version 2.4.6 or higher. The configure
|
If you use flex, you must use version 2.4.6 or higher. The configure
|
||||||
script automatically detects the version of flex and will not use it
|
script automatically detects the version of flex and will not use it
|
||||||
unless it is new enough. You can use "flex -V" to see what version you
|
unless it is new enough. You can use "flex -V" to see what version you
|
||||||
have (unless it's really old). The current version of flex is available
|
have (unless it's really old). The current version of flex is available
|
||||||
via anonymous ftp:
|
at flex.sourceforge.net and often comes packaged by means of the OS.
|
||||||
|
As of this writing, the current version is 2.5.37.
|
||||||
ftp://ftp.ee.lbl.gov/flex-*.tar.Z
|
|
||||||
|
|
||||||
As of this writing, the current version is 2.5.4.
|
|
||||||
|
|
||||||
If you use bison, you must use flex (and visa versa). The configure
|
If you use bison, you must use flex (and visa versa). The configure
|
||||||
script automatically falls back to lex and yacc if both flex and bison
|
script automatically falls back to lex and yacc if both flex and bison
|
||||||
@@ -185,14 +178,14 @@ packet timestamps aren't very good. This appears to be due to haphazard
|
|||||||
handling of the timestamp in the kernel.
|
handling of the timestamp in the kernel.
|
||||||
|
|
||||||
Note well: there is rumoured to be a version of tcpdump floating around
|
Note well: there is rumoured to be a version of tcpdump floating around
|
||||||
called 3.0.3 that includes libpcap and is supposed to support Linux.
|
called 3.0.3 that includes libpcap and is supposed to support Linux.
|
||||||
You should be advised that neither the Network Research Group at LBNL
|
You should be advised that neither the Network Research Group at LBNL
|
||||||
nor the Tcpdump Group ever generated a release with this version number.
|
nor the Tcpdump Group ever generated a release with this version number.
|
||||||
The LBNL Network Research Group notes with interest that a standard
|
The LBNL Network Research Group notes with interest that a standard
|
||||||
cracker trick to get people to install trojans is to distribute bogus
|
cracker trick to get people to install trojans is to distribute bogus
|
||||||
packages that have a version number higher than the current release.
|
packages that have a version number higher than the current release.
|
||||||
They also noted with annoyance that 90% of the Linux related bug reports
|
They also noted with annoyance that 90% of the Linux related bug reports
|
||||||
they got are due to changes made to unofficial versions of their page.
|
they got are due to changes made to unofficial versions of their page.
|
||||||
If you are having trouble but aren't using a version that came from
|
If you are having trouble but aren't using a version that came from
|
||||||
tcpdump.org, please try that before submitting a bug report!
|
tcpdump.org, please try that before submitting a bug report!
|
||||||
|
|
||||||
@@ -352,7 +345,6 @@ nametoaddr.c - hostname to address routines
|
|||||||
nlpid.h - OSI network layer protocol identifier definitions
|
nlpid.h - OSI network layer protocol identifier definitions
|
||||||
net - symlink to bpf/net
|
net - symlink to bpf/net
|
||||||
optimize.c - BPF optimization routines
|
optimize.c - BPF optimization routines
|
||||||
packaging - packaging information for building libpcap RPMs
|
|
||||||
pcap/bluetooth.h - public definition of DLT_BLUETOOTH_HCI_H4_WITH_PHDR header
|
pcap/bluetooth.h - public definition of DLT_BLUETOOTH_HCI_H4_WITH_PHDR header
|
||||||
pcap/bpf.h - BPF definitions
|
pcap/bpf.h - BPF definitions
|
||||||
pcap/namedb.h - public libpcap name database definitions
|
pcap/namedb.h - public libpcap name database definitions
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
License: BSD
|
License: BSD
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
1. Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
@@ -13,7 +13,7 @@ are met:
|
|||||||
3. The names of the authors may not be used to endorse or promote
|
3. The names of the authors may not be used to endorse or promote
|
||||||
products derived from this software without specific prior
|
products derived from this software without specific prior
|
||||||
written permission.
|
written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
#
|
|
||||||
# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.142 2008-11-22 17:30:24 guy Exp $ (LBL)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
||||||
@@ -55,8 +53,9 @@ DEFS = @DEFS@ @V_DEFS@
|
|||||||
ADDLOBJS = @ADDLOBJS@
|
ADDLOBJS = @ADDLOBJS@
|
||||||
ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
|
ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
CFLAGS = @CFLAGS@
|
CROSSFLAGS=
|
||||||
LDFLAGS = @LDFLAGS@
|
CFLAGS = @CFLAGS@ ${CROSSFLAGS}
|
||||||
|
LDFLAGS = @LDFLAGS@ ${CROSSFLAGS}
|
||||||
DYEXT = @DYEXT@
|
DYEXT = @DYEXT@
|
||||||
V_RPATH_OPT = @V_RPATH_OPT@
|
V_RPATH_OPT = @V_RPATH_OPT@
|
||||||
DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
|
DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
|
||||||
@@ -77,7 +76,7 @@ RANLIB = @RANLIB@
|
|||||||
@rm -f $@
|
@rm -f $@
|
||||||
$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
|
$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
|
||||||
|
|
||||||
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@ @CANUSB_SRC@ @DBUS_SRC@
|
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @CAN_SRC@ @NETFILTER_SRC@ @CANUSB_SRC@ @DBUS_SRC@
|
||||||
FSRC = fad-@V_FINDALLDEVS@.c
|
FSRC = fad-@V_FINDALLDEVS@.c
|
||||||
SSRC = @SSRC@
|
SSRC = @SSRC@
|
||||||
CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
|
CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
|
||||||
@@ -99,6 +98,7 @@ PUBHDR = \
|
|||||||
pcap/bluetooth.h \
|
pcap/bluetooth.h \
|
||||||
pcap/ipnet.h \
|
pcap/ipnet.h \
|
||||||
pcap/namedb.h \
|
pcap/namedb.h \
|
||||||
|
pcap/nflog.h \
|
||||||
pcap/pcap.h \
|
pcap/pcap.h \
|
||||||
pcap/sll.h \
|
pcap/sll.h \
|
||||||
pcap/vlan.h \
|
pcap/vlan.h \
|
||||||
@@ -121,17 +121,17 @@ HDR = $(PUBHDR) \
|
|||||||
sunatmpos.h
|
sunatmpos.h
|
||||||
|
|
||||||
TESTS = \
|
TESTS = \
|
||||||
|
capturetest \
|
||||||
filtertest \
|
filtertest \
|
||||||
findalldevstest \
|
findalldevstest \
|
||||||
nonblocktest \
|
|
||||||
opentest \
|
opentest \
|
||||||
selpolltest \
|
selpolltest \
|
||||||
valgrindtest
|
valgrindtest
|
||||||
|
|
||||||
TESTS_SRC = \
|
TESTS_SRC = \
|
||||||
|
tests/capturetest.c \
|
||||||
tests/filtertest.c \
|
tests/filtertest.c \
|
||||||
tests/findalldevstest.c \
|
tests/findalldevstest.c \
|
||||||
tests/nonblocktest.c \
|
|
||||||
tests/opentest.c \
|
tests/opentest.c \
|
||||||
tests/reactivatetest.c \
|
tests/reactivatetest.c \
|
||||||
tests/selpolltest.c \
|
tests/selpolltest.c \
|
||||||
@@ -284,10 +284,11 @@ EXTRA_DIST = \
|
|||||||
msdos/pktdrvr.h \
|
msdos/pktdrvr.h \
|
||||||
msdos/readme.dos \
|
msdos/readme.dos \
|
||||||
org.tcpdump.chmod_bpf.plist \
|
org.tcpdump.chmod_bpf.plist \
|
||||||
packaging/pcap.spec.in \
|
|
||||||
pcap-bpf.c \
|
pcap-bpf.c \
|
||||||
pcap-bt-linux.c \
|
pcap-bt-linux.c \
|
||||||
pcap-bt-linux.h \
|
pcap-bt-linux.h \
|
||||||
|
pcap-bt-monitor-linux.c \
|
||||||
|
pcap-bt-monitor-linux.h \
|
||||||
pcap-can-linux.c \
|
pcap-can-linux.c \
|
||||||
pcap-can-linux.h \
|
pcap-can-linux.h \
|
||||||
pcap-canusb-linux.c \
|
pcap-canusb-linux.c \
|
||||||
@@ -323,6 +324,7 @@ EXTRA_DIST = \
|
|||||||
pcap-usb-linux.h \
|
pcap-usb-linux.h \
|
||||||
pcap-win32.c \
|
pcap-win32.c \
|
||||||
runlex.sh \
|
runlex.sh \
|
||||||
|
scanner.c.top \
|
||||||
scanner.l \
|
scanner.l \
|
||||||
Win32/Include/Gnuc.h \
|
Win32/Include/Gnuc.h \
|
||||||
Win32/Include/addrinfo.h \
|
Win32/Include/addrinfo.h \
|
||||||
@@ -516,15 +518,15 @@ pcap-config: $(srcdir)/pcap-config.in ./config.status
|
|||||||
#
|
#
|
||||||
tests: $(TESTS)
|
tests: $(TESTS)
|
||||||
|
|
||||||
|
capturetest: tests/capturetest.c libpcap.a
|
||||||
|
$(CC) $(FULL_CFLAGS) -I. -L. -o capturetest $(srcdir)/tests/capturetest.c libpcap.a $(LIBS)
|
||||||
|
|
||||||
filtertest: tests/filtertest.c libpcap.a
|
filtertest: tests/filtertest.c libpcap.a
|
||||||
$(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/tests/filtertest.c libpcap.a $(LIBS)
|
$(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/tests/filtertest.c libpcap.a $(LIBS)
|
||||||
|
|
||||||
findalldevstest: tests/findalldevstest.c libpcap.a
|
findalldevstest: tests/findalldevstest.c libpcap.a
|
||||||
$(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest $(srcdir)/tests/findalldevstest.c libpcap.a $(LIBS)
|
$(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest $(srcdir)/tests/findalldevstest.c libpcap.a $(LIBS)
|
||||||
|
|
||||||
nonblocktest: tests/nonblocktest.c libpcap.a
|
|
||||||
$(CC) $(FULL_CFLAGS) -I. -L. -o nonblocktest $(srcdir)/tests/nonblocktest.c libpcap.a $(LIBS)
|
|
||||||
|
|
||||||
opentest: tests/opentest.c libpcap.a
|
opentest: tests/opentest.c libpcap.a
|
||||||
$(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS)
|
$(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS)
|
||||||
|
|
||||||
@@ -595,6 +597,8 @@ install: install-shared install-archive pcap-config
|
|||||||
$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline.3pcap && \
|
$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline.3pcap && \
|
||||||
rm -f pcap_fopen_offline_with_tstamp_precision.3pcap && \
|
rm -f pcap_fopen_offline_with_tstamp_precision.3pcap && \
|
||||||
$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap && \
|
$(LN_S) pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap && \
|
||||||
|
rm -f pcap_tstamp_type_val_to_description.3pcap && \
|
||||||
|
$(LN_S) pcap_tstamp_type_val_to_name.3pcap pcap_tstamp_type_val_to_description.3pcap && \
|
||||||
rm -f pcap_getnonblock.3pcap && \
|
rm -f pcap_getnonblock.3pcap && \
|
||||||
$(LN_S) pcap_setnonblock.3pcap pcap_getnonblock.3pcap)
|
$(LN_S) pcap_setnonblock.3pcap pcap_getnonblock.3pcap)
|
||||||
for i in $(MANFILE); do \
|
for i in $(MANFILE); do \
|
||||||
@@ -678,6 +682,7 @@ uninstall: uninstall-shared
|
|||||||
rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
|
rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
|
||||||
rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline_with_tstamp_precision.3pcap
|
rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline_with_tstamp_precision.3pcap
|
||||||
rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
|
rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
|
||||||
|
rm -f $(DESTDIR)$(mandir)/man3/pcap_tstamp_type_val_to_description.3pcap
|
||||||
for i in $(MANFILE); do \
|
for i in $(MANFILE); do \
|
||||||
rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
|
rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
|
||||||
for i in $(MANMISC); do \
|
for i in $(MANMISC); do \
|
||||||
@@ -717,10 +722,6 @@ distclean: clean
|
|||||||
tags: $(TAGFILES)
|
tags: $(TAGFILES)
|
||||||
ctags -wtd $(TAGFILES)
|
ctags -wtd $(TAGFILES)
|
||||||
|
|
||||||
packaging/pcap.spec: packaging/pcap.spec.in VERSION
|
|
||||||
RPMVERSION=`cat VERSION | sed s/-.*//g`; \
|
|
||||||
sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@
|
|
||||||
|
|
||||||
releasetar:
|
releasetar:
|
||||||
@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
|
@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
|
||||||
mkdir $$name; \
|
mkdir $$name; \
|
||||||
@@ -731,4 +732,4 @@ releasetar:
|
|||||||
rm -rf $$name
|
rm -rf $$name
|
||||||
|
|
||||||
depend: $(GENSRC) $(GENHDR) bpf_filter.c
|
depend: $(GENSRC) $(GENHDR) bpf_filter.c
|
||||||
$(MKDEP) -c $(CC) -m $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
|
$(MKDEP) -c $(CC) -m $(CFLAGS) $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
From 0198a593ef29d7af319b02dd33f251b58d117827 Mon Sep 17 00:00:00 2001
|
From f38b1fc263d65a53746108e2c9afacf1dc6a058a Mon Sep 17 00:00:00 2001
|
||||||
From: David Fifield <david@bamsoftware.com>
|
From: Daniel Miller <daniel@bonsaiviking.com>
|
||||||
Date: Mon, 9 Apr 2012 16:55:51 -0700
|
Date: Fri, 1 May 2015 14:44:28 +0000
|
||||||
Subject: [PATCH 1/2] Don't autogenerate Lex/Yacc files.
|
Subject: [PATCH 1/2] Don't autogenerate Lex/Yacc files.
|
||||||
|
|
||||||
---
|
---
|
||||||
Makefile.in | 30 ++++++++++--------------------
|
libpcap/Makefile.in | 33 ++++++++++-----------------------
|
||||||
configure.in | 20 --------------------
|
libpcap/configure.in | 20 --------------------
|
||||||
2 files changed, 10 insertions(+), 40 deletions(-)
|
2 files changed, 10 insertions(+), 43 deletions(-)
|
||||||
|
|
||||||
diff --git Makefile.in Makefile.in
|
diff --git a/libpcap/Makefile.in b/libpcap/Makefile.in
|
||||||
index 912b7e3..0db12a4 100644
|
index f317973..577b848 100644
|
||||||
--- Makefile.in
|
--- a/libpcap/Makefile.in
|
||||||
+++ Makefile.in
|
+++ b/libpcap/Makefile.in
|
||||||
@@ -67,14 +67,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
@@ -69,14 +69,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ index 912b7e3..0db12a4 100644
|
|||||||
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
|
# 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
|
# 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.
|
# problem if you don't own the file but can write to the directory.
|
||||||
@@ -147,7 +139,7 @@ TAGFILES = \
|
@@ -152,7 +144,7 @@ TAGFILES = \
|
||||||
$(SRC) $(HDR)
|
$(SRC) $(HDR)
|
||||||
|
|
||||||
CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
|
CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
|
||||||
@@ -36,7 +36,7 @@ index 912b7e3..0db12a4 100644
|
|||||||
lex.yy.c pcap-config
|
lex.yy.c pcap-config
|
||||||
|
|
||||||
MAN1 = pcap-config.1
|
MAN1 = pcap-config.1
|
||||||
@@ -345,6 +337,15 @@ EXTRA_DIST = \
|
@@ -360,6 +352,15 @@ EXTRA_DIST = \
|
||||||
|
|
||||||
all: libpcap.a shared pcap-config
|
all: libpcap.a shared pcap-config
|
||||||
|
|
||||||
@@ -52,13 +52,16 @@ index 912b7e3..0db12a4 100644
|
|||||||
libpcap.a: $(OBJ)
|
libpcap.a: $(OBJ)
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
||||||
@@ -428,22 +429,11 @@ libpcap.shareda: $(OBJ)
|
@@ -443,25 +444,11 @@ libpcap.shareda: $(OBJ)
|
||||||
#
|
#
|
||||||
libpcap.none:
|
libpcap.none:
|
||||||
|
|
||||||
-scanner.c: $(srcdir)/scanner.l
|
-scanner.c: $(srcdir)/scanner.l
|
||||||
- @rm -f $@
|
- @rm -f $@ $@.bottom
|
||||||
- $(srcdir)/runlex.sh $(LEX) -o$@ $<
|
- $(srcdir)/runlex.sh $(LEX) -o$@ $<
|
||||||
|
- mv $@ $@.bottom
|
||||||
|
- cat $@.top $@.bottom > $@
|
||||||
|
- @rm $@.bottom
|
||||||
-
|
-
|
||||||
scanner.o: scanner.c tokdefs.h
|
scanner.o: scanner.c tokdefs.h
|
||||||
$(CC) $(FULL_CFLAGS) -c scanner.c
|
$(CC) $(FULL_CFLAGS) -c scanner.c
|
||||||
@@ -75,11 +78,11 @@ index 912b7e3..0db12a4 100644
|
|||||||
grammar.o: grammar.c
|
grammar.o: grammar.c
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
$(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
|
$(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
|
||||||
diff --git configure.in configure.in
|
diff --git a/libpcap/configure.in b/libpcap/configure.in
|
||||||
index 6a146ca..24097b2 100644
|
index be4b29e..ec87283 100644
|
||||||
--- configure.in
|
--- a/libpcap/configure.in
|
||||||
+++ configure.in
|
+++ b/libpcap/configure.in
|
||||||
@@ -998,24 +998,6 @@ if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
|
@@ -1051,24 +1051,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)
|
AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -104,7 +107,7 @@ index 6a146ca..24097b2 100644
|
|||||||
#
|
#
|
||||||
# Assume, by default, no support for shared libraries and V7/BSD convention
|
# 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).
|
# for man pages (file formats in section 5, miscellaneous info in section 7).
|
||||||
@@ -1250,13 +1232,11 @@ AC_SUBST(V_CCOPT)
|
@@ -1351,13 +1333,11 @@ AC_SUBST(V_CCOPT)
|
||||||
AC_SUBST(V_DEFS)
|
AC_SUBST(V_DEFS)
|
||||||
AC_SUBST(V_FINDALLDEVS)
|
AC_SUBST(V_FINDALLDEVS)
|
||||||
AC_SUBST(V_INCLS)
|
AC_SUBST(V_INCLS)
|
||||||
@@ -119,5 +122,5 @@ index 6a146ca..24097b2 100644
|
|||||||
AC_SUBST(ADDLARCHIVEOBJS)
|
AC_SUBST(ADDLARCHIVEOBJS)
|
||||||
AC_SUBST(SSRC)
|
AC_SUBST(SSRC)
|
||||||
--
|
--
|
||||||
1.7.9.5
|
1.9.1
|
||||||
|
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
From 3807934db1b073534a01d9a8546cddcec9be501f Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Fifield <david@bamsoftware.com>
|
|
||||||
Date: Mon, 9 Apr 2012 17:02:40 -0700
|
|
||||||
Subject: [PATCH 2/2] 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 ++++++++++--------
|
|
||||||
config.h.in | 3 +++
|
|
||||||
3 files changed, 31 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 17bd0f5..bd2457d 100644
|
|
||||||
--- pcap-linux.c
|
|
||||||
+++ pcap-linux.c
|
|
||||||
@@ -196,17 +196,19 @@ 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 TPACKET3_HDRLEN
|
|
||||||
-# define HAVE_TPACKET3
|
|
||||||
-# endif /* TPACKET3_HDRLEN */
|
|
||||||
-# ifdef TPACKET2_HDRLEN
|
|
||||||
-# define HAVE_TPACKET2
|
|
||||||
-# else /* TPACKET2_HDRLEN */
|
|
||||||
-# define TPACKET_V1 0 /* Old kernel with only V1, so no TPACKET_Vn defined */
|
|
||||||
-# endif /* TPACKET2_HDRLEN */
|
|
||||||
-# endif /* TPACKET_HDRLEN */
|
|
||||||
+# ifdef PCAP_SUPPORT_PACKET_RING
|
|
||||||
+# ifdef TPACKET_HDRLEN
|
|
||||||
+# define HAVE_PACKET_RING
|
|
||||||
+# ifdef TPACKET3_HDRLEN
|
|
||||||
+# define HAVE_TPACKET3
|
|
||||||
+# endif /* TPACKET3_HDRLEN */
|
|
||||||
+# ifdef TPACKET2_HDRLEN
|
|
||||||
+# define HAVE_TPACKET2
|
|
||||||
+# else /* TPACKET2_HDRLEN */
|
|
||||||
+# define TPACKET_V1 0 /* Old kernel with only V1, so no TPACKET_Vn defined */
|
|
||||||
+# endif /* TPACKET2_HDRLEN */
|
|
||||||
+# endif /* TPACKET_HDRLEN */
|
|
||||||
+# endif /* PCAP_SUPPORT_PACKET_RING */
|
|
||||||
#endif /* PF_PACKET */
|
|
||||||
|
|
||||||
#ifdef SO_ATTACH_FILTER
|
|
||||||
--- config.h.in
|
|
||||||
+++ config.h.in
|
|
||||||
@@ -271,6 +271,9 @@
|
|
||||||
/* target host supports USB sniffing */
|
|
||||||
#undef PCAP_SUPPORT_USB
|
|
||||||
|
|
||||||
+/* target host supports packet ring capture */
|
|
||||||
+#undef PCAP_SUPPORT_PACKET_RING
|
|
||||||
+
|
|
||||||
/* include ACN support */
|
|
||||||
#undef SITA
|
|
||||||
|
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
From 7a42932439162be1f263986cdc7bbef78840a71a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Miller <daniel@bonsaiviking.com>
|
||||||
|
Date: Fri, 1 May 2015 14:53:42 +0000
|
||||||
|
Subject: [PATCH 2/2] Disable unnecessary features
|
||||||
|
|
||||||
The following features are disabled:
|
The following features are disabled:
|
||||||
|
|
||||||
* monitor-mode sniffing of wireless interfaces on Linux, via libnl
|
* monitor-mode sniffing of wireless interfaces on Linux, via libnl
|
||||||
@@ -6,12 +11,15 @@ The following features are disabled:
|
|||||||
* canusb support
|
* canusb support
|
||||||
* CAN support
|
* CAN support
|
||||||
* dbus capture support
|
* dbus capture support
|
||||||
|
---
|
||||||
|
libpcap/configure.in | 24 ++++++++++++------------
|
||||||
|
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
diff --git a/libpcap/configure.in b/libpcap/configure.in
|
diff --git a/libpcap/configure.in b/libpcap/configure.in
|
||||||
index 5386062..8ceddd7 100644
|
index ec87283..ad2e437 100644
|
||||||
--- a/libpcap/configure.in
|
--- a/libpcap/configure.in
|
||||||
+++ b/libpcap/configure.in
|
+++ b/libpcap/configure.in
|
||||||
@@ -441,10 +441,10 @@ linux)
|
@@ -450,10 +450,10 @@ linux)
|
||||||
# Do we have libnl?
|
# Do we have libnl?
|
||||||
#
|
#
|
||||||
AC_ARG_WITH(libnl,
|
AC_ARG_WITH(libnl,
|
||||||
@@ -23,8 +31,8 @@ index 5386062..8ceddd7 100644
|
|||||||
+ if test x$with_libnl = xyes ; then
|
+ if test x$with_libnl = xyes ; then
|
||||||
have_any_nl="no"
|
have_any_nl="no"
|
||||||
|
|
||||||
#
|
incdir=-I/usr/include/libnl3
|
||||||
@@ -1285,8 +1285,8 @@ solaris*)
|
@@ -1301,8 +1301,8 @@ solaris*)
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_ARG_ENABLE(shared,
|
AC_ARG_ENABLE(shared,
|
||||||
@@ -35,43 +43,43 @@ index 5386062..8ceddd7 100644
|
|||||||
|
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_CHECK_TOOL([AR], [ar])
|
AC_CHECK_TOOL([AR], [ar])
|
||||||
@@ -1434,9 +1434,9 @@ AC_SUBST(PCAP_SUPPORT_NETFILTER)
|
@@ -1457,9 +1457,9 @@ AC_SUBST(PCAP_SUPPORT_NETFILTER)
|
||||||
AC_SUBST(NETFILTER_SRC)
|
AC_SUBST(NETFILTER_SRC)
|
||||||
|
|
||||||
AC_ARG_ENABLE([bluetooth],
|
AC_ARG_ENABLE([bluetooth],
|
||||||
-[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
|
-[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
|
||||||
+[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=no@:>@])],
|
+[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=no@:>@])],
|
||||||
[],
|
[],
|
||||||
- [enable_bluetooth=yes])
|
- [enable_bluetooth=ifsupportavailable])
|
||||||
+ [enable_bluetooth=no])
|
+ [enable_bluetooth=no])
|
||||||
|
|
||||||
if test "x$enable_bluetooth" != "xno" ; then
|
if test "x$enable_bluetooth" != "xno" ; then
|
||||||
dnl check for Bluetooth sniffing support
|
dnl check for Bluetooth sniffing support
|
||||||
@@ -1480,9 +1480,9 @@ if test "x$enable_bluetooth" != "xno" ; then
|
@@ -1536,9 +1536,9 @@ if test "x$enable_bluetooth" != "xno" ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([canusb],
|
AC_ARG_ENABLE([canusb],
|
||||||
-[AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
|
-[AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
|
||||||
+[AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=no@:>@])],
|
+[AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=no@:>@])],
|
||||||
[],
|
[],
|
||||||
- [enable_canusb=yes])
|
- [enable_canusb=ifsupportavailable])
|
||||||
+ [enable_canusb=no])
|
+ [enable_canusb=no])
|
||||||
|
|
||||||
if test "x$enable_canusb" != "xno" ; then
|
if test "x$enable_canusb" != "xno" ; then
|
||||||
dnl check for canusb support
|
dnl check for canusb support
|
||||||
@@ -1507,9 +1507,9 @@ if test "x$enable_canusb" != "xno" ; then
|
@@ -1582,9 +1582,9 @@ if test "x$enable_canusb" != "xno" ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([can],
|
AC_ARG_ENABLE([can],
|
||||||
-[AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
|
-[AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
|
||||||
+[AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=no@:>@])],
|
+[AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=no@:>@])],
|
||||||
[],
|
[],
|
||||||
- [enable_can=yes])
|
- [enable_can=ifsupportavailable])
|
||||||
+ [enable_can=no])
|
+ [enable_can=no])
|
||||||
|
|
||||||
if test "x$enable_can" != "xno" ; then
|
if test "x$enable_can" != "xno" ; then
|
||||||
dnl check for CAN sniffing support
|
dnl check for CAN sniffing support
|
||||||
@@ -1532,9 +1532,9 @@ if test "x$enable_can" != "xno" ; then
|
@@ -1619,9 +1619,9 @@ if test "x$enable_can" != "xno" ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([dbus],
|
AC_ARG_ENABLE([dbus],
|
||||||
@@ -82,4 +90,7 @@ index 5386062..8ceddd7 100644
|
|||||||
+ [enable_dbus=no])
|
+ [enable_dbus=no])
|
||||||
|
|
||||||
if test "x$enable_dbus" != "xno"; then
|
if test "x$enable_dbus" != "xno"; then
|
||||||
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
|
if test "x$enable_dbus" = "xyes"; then
|
||||||
|
--
|
||||||
|
1.9.1
|
||||||
|
|
||||||
@@ -9,14 +9,13 @@ cd nmap
|
|||||||
rsync -rv --delete ~/libpcap-X.Y/ ~/nmap/libpcap/
|
rsync -rv --delete ~/libpcap-X.Y/ ~/nmap/libpcap/
|
||||||
git add -A libpcap
|
git add -A libpcap
|
||||||
cd libpcap
|
cd libpcap
|
||||||
# Apply the pre-configure patch.
|
|
||||||
git apply -p0 --directory=libpcap/ ~/NMAP_MODIFICATIONS/pre-configure.patch
|
|
||||||
./configure
|
./configure
|
||||||
make grammar.c scanner.c scanner.h tokdefs.h
|
make grammar.c scanner.c scanner.h tokdefs.h
|
||||||
git add grammar.c scanner.c scanner.h tokdefs.h
|
git add grammar.c scanner.c scanner.h tokdefs.h
|
||||||
cd ..
|
cd ..
|
||||||
# Apply patches.
|
# Apply patches.
|
||||||
git apply -p0 --directory=libpcap/ ~/NMAP_MODIFICATIONS/000*
|
git apply ~/NMAP_MODIFICATIONS/000*
|
||||||
|
# Make changes as necessary and update the patch files
|
||||||
cd libpcap
|
cd libpcap
|
||||||
autoconf
|
autoconf
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
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,5 +1,3 @@
|
|||||||
@(#) $Header: /tcpdump/master/libpcap/README,v 1.34 2008-12-14 19:44:14 guy Exp $ (LBL)
|
|
||||||
|
|
||||||
LIBPCAP 1.x.y
|
LIBPCAP 1.x.y
|
||||||
|
|
||||||
www.tcpdump.org
|
www.tcpdump.org
|
||||||
@@ -78,15 +76,15 @@ information on configuring that option.
|
|||||||
|
|
||||||
Note to Linux distributions and *BSD systems that include libpcap:
|
Note to Linux distributions and *BSD systems that include libpcap:
|
||||||
|
|
||||||
There's now a rule to make a shared library, which should work on Linux
|
There's now a rule to make a shared library, which should work on Linux
|
||||||
and *BSD, among other platforms.
|
and *BSD, among other platforms.
|
||||||
|
|
||||||
It sets the soname of the library to "libpcap.so.1"; this is what it
|
It sets the soname of the library to "libpcap.so.1"; this is what it
|
||||||
should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as
|
should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as
|
||||||
that.
|
that.
|
||||||
|
|
||||||
We've been maintaining binary compatibility between libpcap releases for
|
We've been maintaining binary compatibility between libpcap releases for
|
||||||
quite a while; there's no reason to tie a binary linked with libpcap to
|
quite a while; there's no reason to tie a binary linked with libpcap to
|
||||||
a particular release of libpcap.
|
a particular release of libpcap.
|
||||||
|
|
||||||
Problems, bugs, questions, desirable enhancements, etc. should be sent
|
Problems, bugs, questions, desirable enhancements, etc. should be sent
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Under Win32, libpcap is integrated in the WinPcap packet capture system.
|
Under Win32, libpcap is integrated in the WinPcap packet capture system.
|
||||||
WinPcap provides a framework that allows libpcap to capture the packets
|
WinPcap provides a framework that allows libpcap to capture the packets
|
||||||
under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000
|
under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000
|
||||||
and Windows XP.
|
and Windows XP.
|
||||||
WinPcap binaries and source code can be found at http://winpcap.polito.it:
|
WinPcap binaries and source code can be found at http://winpcap.polito.it:
|
||||||
they include also a developer's pack with all the necessary to compile
|
they include also a developer's pack with all the necessary to compile
|
||||||
libpcap-based applications under Windows.
|
libpcap-based applications under Windows.
|
||||||
|
|
||||||
How to compile libpcap with Visual Studio
|
How to compile libpcap with Visual Studio
|
||||||
@@ -12,35 +12,35 @@ How to compile libpcap with Visual Studio
|
|||||||
In order to compile libpcap you will need:
|
In order to compile libpcap you will need:
|
||||||
|
|
||||||
- version 6 (or higher) of Microsoft Visual Studio
|
- version 6 (or higher) of Microsoft Visual Studio
|
||||||
- The November 2001 (or later) edition of Microsoft Platform
|
- The November 2001 (or later) edition of Microsoft Platform
|
||||||
Software Development Kit (SDK), that contains some necessary includes
|
Software Development Kit (SDK), that contains some necessary includes
|
||||||
for IPv6 support. You can download it from http://www.microsoft.com/sdk
|
for IPv6 support. You can download it from http://www.microsoft.com/sdk
|
||||||
- the latest WinPcap sources from http://winpcap.polito.it/install
|
- the latest WinPcap sources from http://winpcap.polito.it/install
|
||||||
|
|
||||||
The WinPcap source code already contains a recent (usually the latest
|
The WinPcap source code already contains a recent (usually the latest
|
||||||
stable) version of libpcap. If you need to compile a different one,
|
stable) version of libpcap. If you need to compile a different one,
|
||||||
simply download it from www.tcpdump.org and copy the sources in the
|
simply download it from www.tcpdump.org and copy the sources in the
|
||||||
winpcap\wpcap\libpcap folder of the WinPcap distribution. If you want to
|
winpcap\wpcap\libpcap folder of the WinPcap distribution. If you want to
|
||||||
compile a libpcap source retrieved from the tcpdump.org Git, you will
|
compile a libpcap source retrieved from the tcpdump.org Git, you will
|
||||||
have to create the scanner and the grammar by hand (with lex and yacc)
|
have to create the scanner and the grammar by hand (with lex and yacc)
|
||||||
or with the cygnus makefile, since The Visual Studio project is not able
|
or with the cygnus makefile, since The Visual Studio project is not able
|
||||||
to build them.
|
to build them.
|
||||||
|
|
||||||
Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and
|
Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and
|
||||||
build wpcap.dll. wpcap.lib, the library file to link with the applications,
|
build wpcap.dll. wpcap.lib, the library file to link with the applications,
|
||||||
will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in
|
will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in
|
||||||
winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type
|
winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type
|
||||||
of binary that is being created.
|
of binary that is being created.
|
||||||
|
|
||||||
How to compile libpcap with Cygnus
|
How to compile libpcap with Cygnus
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code
|
To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code
|
||||||
distribution and type "make". libwpcap.a, the library file to link with the
|
distribution and type "make". libwpcap.a, the library file to link with the
|
||||||
applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be
|
applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be
|
||||||
generated in winpcap\wpcap\prj.
|
generated in winpcap\wpcap\prj.
|
||||||
|
|
||||||
Remember, you CANNOT use the MSVC-generated .lib files with gcc, use
|
Remember, you CANNOT use the MSVC-generated .lib files with gcc, use
|
||||||
libwpcap.a instead.
|
libwpcap.a instead.
|
||||||
|
|
||||||
"make install" installs wpcap.dll in the Windows system folder.
|
"make install" installs wpcap.dll in the Windows system folder.
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ Using BPF:
|
|||||||
same, and the configure script should detect that it's on an AIX
|
same, and the configure script should detect that it's on an AIX
|
||||||
system and choose BPF even if the devices aren't there.
|
system and choose BPF even if the devices aren't there.
|
||||||
|
|
||||||
|
Also note that tcpdump _binary_ compiled on AIX 4 may have a problem
|
||||||
|
doing the initial loading of the BPF driver if copied to AIX 5 and
|
||||||
|
run there (GH #52). tcpdump binary natively compiled on AIX 5 should
|
||||||
|
not have this issue.
|
||||||
|
|
||||||
(2) If libpcap doesn't compile on your machine when configured to use
|
(2) If libpcap doesn't compile on your machine when configured to use
|
||||||
BPF, or if the workarounds fail to make it work correctly, you
|
BPF, or if the workarounds fail to make it work correctly, you
|
||||||
should send to tcpdump-workers@lists.tcpdump.org a detailed bug
|
should send to tcpdump-workers@lists.tcpdump.org a detailed bug
|
||||||
@@ -71,8 +76,8 @@ If you use DLPI:
|
|||||||
Then you need to type:
|
Then you need to type:
|
||||||
|
|
||||||
strload -f /etc/dlpi.conf
|
strload -f /etc/dlpi.conf
|
||||||
|
|
||||||
Check again with strload -q -d dlpi that the dlpi driver is loaded.
|
Check again with strload -q -d dlpi that the dlpi driver is loaded.
|
||||||
|
|
||||||
Alternatively, you can uncomment the lines for DLPI in
|
Alternatively, you can uncomment the lines for DLPI in
|
||||||
/etc/pse.conf and reboot the machine; this way DLPI will always
|
/etc/pse.conf and reboot the machine; this way DLPI will always
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ HP-UX and cannot upgrade, please continue reading.
|
|||||||
HP-UX patches to fix packet capture problems
|
HP-UX patches to fix packet capture problems
|
||||||
|
|
||||||
Note that packet-capture programs such as tcpdump may, on HP-UX, not be
|
Note that packet-capture programs such as tcpdump may, on HP-UX, not be
|
||||||
able to see packets sent from the machine on which they're running.
|
able to see packets sent from the machine on which they're running.
|
||||||
Some articles on groups.google.com discussing this are:
|
Some articles on groups.google.com discussing this are:
|
||||||
|
|
||||||
http://groups.google.com/groups?selm=82ld3v%2480i%241%40mamenchi.zrz.TU-Berlin.DE
|
http://groups.google.com/groups?selm=82ld3v%2480i%241%40mamenchi.zrz.TU-Berlin.DE
|
||||||
|
|
||||||
which says:
|
which says:
|
||||||
|
|
||||||
Newsgroups: comp.sys.hp.hpux
|
Newsgroups: comp.sys.hp.hpux
|
||||||
Subject: Re: Did someone made tcpdump working on 10.20 ?
|
Subject: Re: Did someone made tcpdump working on 10.20 ?
|
||||||
Date: 12/08/1999
|
Date: 12/08/1999
|
||||||
From: Lutz Jaenicke <jaenicke@emserv1.ee.TU-Berlin.DE>
|
From: Lutz Jaenicke <jaenicke@emserv1.ee.TU-Berlin.DE>
|
||||||
@@ -27,14 +27,14 @@ which says:
|
|||||||
>must me "patched" (poked) in order to see outbound data in promiscuous mode.
|
>must me "patched" (poked) in order to see outbound data in promiscuous mode.
|
||||||
>Many things to do .... So the question is : did someone has already this
|
>Many things to do .... So the question is : did someone has already this
|
||||||
>"ready to use" PHNE_**** patch ?
|
>"ready to use" PHNE_**** patch ?
|
||||||
|
|
||||||
Two things:
|
Two things:
|
||||||
1. You do need a late "LAN products cumulative patch" (e.g. PHNE_18173
|
1. You do need a late "LAN products cumulative patch" (e.g. PHNE_18173
|
||||||
for s700/10.20).
|
for s700/10.20).
|
||||||
2. You must use
|
2. You must use
|
||||||
echo 'lanc_outbound_promisc_flag/W1' | /usr/bin/adb -w /stand/vmunix /dev/kmem
|
echo 'lanc_outbound_promisc_flag/W1' | /usr/bin/adb -w /stand/vmunix /dev/kmem
|
||||||
You can insert this e.g. into /sbin/init.d/lan
|
You can insert this e.g. into /sbin/init.d/lan
|
||||||
|
|
||||||
Best regards,
|
Best regards,
|
||||||
Lutz
|
Lutz
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ and
|
|||||||
|
|
||||||
which says:
|
which says:
|
||||||
|
|
||||||
Newsgroups: comp.sys.hp.hpux
|
Newsgroups: comp.sys.hp.hpux
|
||||||
Subject: Re: tcpdump only shows incoming packets
|
Subject: Re: tcpdump only shows incoming packets
|
||||||
Date: 02/15/2000
|
Date: 02/15/2000
|
||||||
From: Rick Jones <foo@bar.baz.invalid>
|
From: Rick Jones <foo@bar.baz.invalid>
|
||||||
@@ -56,12 +56,12 @@ which says:
|
|||||||
> outgoing. I have tried tcpflow-0.12 which also uses libpcap and the
|
> outgoing. I have tried tcpflow-0.12 which also uses libpcap and the
|
||||||
> same thing happens. Could someone please give me a hint on how to
|
> same thing happens. Could someone please give me a hint on how to
|
||||||
> get this right?
|
> get this right?
|
||||||
|
|
||||||
Search/Read the archives ?-)
|
Search/Read the archives ?-)
|
||||||
|
|
||||||
What you are seeing is expected, un-patched, behaviour for an HP-UX
|
What you are seeing is expected, un-patched, behaviour for an HP-UX
|
||||||
system. On 11.00, you need to install the latest lancommon/DLPI
|
system. On 11.00, you need to install the latest lancommon/DLPI
|
||||||
patches, and then the latest driver patch for the interface(s) in use.
|
patches, and then the latest driver patch for the interface(s) in use.
|
||||||
At that point, a miracle happens and you should start seeing outbound
|
At that point, a miracle happens and you should start seeing outbound
|
||||||
traffic.
|
traffic.
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ which says:
|
|||||||
From: Harald Skotnes <harald@cc.uit.no>
|
From: Harald Skotnes <harald@cc.uit.no>
|
||||||
|
|
||||||
Rick Jones wrote:
|
Rick Jones wrote:
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
> What you are seeing is expected, un-patched, behaviour for an HP-UX
|
> What you are seeing is expected, un-patched, behaviour for an HP-UX
|
||||||
@@ -87,7 +87,7 @@ which says:
|
|||||||
> patches, and then the latest driver patch for the interface(s) in
|
> patches, and then the latest driver patch for the interface(s) in
|
||||||
> use. At that point, a miracle happens and you should start seeing
|
> use. At that point, a miracle happens and you should start seeing
|
||||||
> outbound traffic.
|
> outbound traffic.
|
||||||
|
|
||||||
Thanks a lot. I have this problem on several machines running HPUX
|
Thanks a lot. I have this problem on several machines running HPUX
|
||||||
10.20 and 11.00. The machines where patched up before y2k so did not
|
10.20 and 11.00. The machines where patched up before y2k so did not
|
||||||
know what to think. Anyway I have now installed PHNE_19766,
|
know what to think. Anyway I have now installed PHNE_19766,
|
||||||
@@ -101,7 +101,7 @@ And another message to tcpdump-workers@tcpdump.org, from Rick Jones:
|
|||||||
|
|
||||||
Date: Mon, 29 Apr 2002 15:59:55 -0700
|
Date: Mon, 29 Apr 2002 15:59:55 -0700
|
||||||
From: Rick Jones
|
From: Rick Jones
|
||||||
To: tcpdump-workers@tcpdump.org
|
To: tcpdump-workers@tcpdump.org
|
||||||
Subject: Re: [tcpdump-workers] I Can't Capture the Outbound Traffic
|
Subject: Re: [tcpdump-workers] I Can't Capture the Outbound Traffic
|
||||||
|
|
||||||
...
|
...
|
||||||
@@ -130,21 +130,21 @@ captures on HP-UX 9.x:
|
|||||||
|
|
||||||
Dave Barr (barr@cis.ohio-state.edu) wrote:
|
Dave Barr (barr@cis.ohio-state.edu) wrote:
|
||||||
: Has anyone ported tcpdump (or something similar) to HP/UX 9.x?
|
: Has anyone ported tcpdump (or something similar) to HP/UX 9.x?
|
||||||
|
|
||||||
I'm reasonably confident that any port of tcpdump to 9.X would require
|
I'm reasonably confident that any port of tcpdump to 9.X would require
|
||||||
the (then optional) STREAMS product. This would bring DLPI, which is
|
the (then optional) STREAMS product. This would bring DLPI, which is
|
||||||
what one uses to access interfaces in promiscuous mode.
|
what one uses to access interfaces in promiscuous mode.
|
||||||
|
|
||||||
I'm not sure that HP even sells the 9.X STREAMS product any longer,
|
I'm not sure that HP even sells the 9.X STREAMS product any longer,
|
||||||
since HP-UX 9.X is off the pricelist (well, maybe 9.10 for the old 68K
|
since HP-UX 9.X is off the pricelist (well, maybe 9.10 for the old 68K
|
||||||
devices).
|
devices).
|
||||||
|
|
||||||
Your best bet is to be up on 10.20 or better if that is at all
|
Your best bet is to be up on 10.20 or better if that is at all
|
||||||
possible. If your hardware is supported by it, I'd go with HP-UX 11.
|
possible. If your hardware is supported by it, I'd go with HP-UX 11.
|
||||||
If you want to see the system's own outbound traffic, you'll never get
|
If you want to see the system's own outbound traffic, you'll never get
|
||||||
that functionality on 9.X, but it might happen at some point for 10.20
|
that functionality on 9.X, but it might happen at some point for 10.20
|
||||||
and 11.X.
|
and 11.X.
|
||||||
|
|
||||||
rick jones
|
rick jones
|
||||||
|
|
||||||
(as per other messages cited here, the ability to see the system's own
|
(as per other messages cited here, the ability to see the system's own
|
||||||
@@ -178,12 +178,12 @@ An additional note, from Jost Martin, for HP-UX 10.20:
|
|||||||
(thanks to hildeb@www.stahl.bau.tu-bs.de (Ralf Hildebrandt) who
|
(thanks to hildeb@www.stahl.bau.tu-bs.de (Ralf Hildebrandt) who
|
||||||
posted the security-part some time ago)
|
posted the security-part some time ago)
|
||||||
|
|
||||||
<<hack_ip_stack>>
|
<<hack_ip_stack>>
|
||||||
|
|
||||||
(Don't switch IP-forwarding off, if you need it !)
|
(Don't switch IP-forwarding off, if you need it !)
|
||||||
Install the hack as /sbin/init.d/hacl_ip_stack (adjust
|
Install the hack as /sbin/init.d/hacl_ip_stack (adjust
|
||||||
permissions !) and make a sequencing-symlink
|
permissions !) and make a sequencing-symlink
|
||||||
/sbin/rc2.d/S350hack_ip_stack pointing to this script.
|
/sbin/rc2.d/S350hack_ip_stack pointing to this script.
|
||||||
Now all this is done on every reboot.
|
Now all this is done on every reboot.
|
||||||
|
|
||||||
According to Rick Jones, the global promiscuous switch also has to be
|
According to Rick Jones, the global promiscuous switch also has to be
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ the 2.0[.x] kernel:
|
|||||||
The Packet protocol is used by applications which communicate
|
The Packet protocol is used by applications which communicate
|
||||||
directly with network devices without an intermediate network
|
directly with network devices without an intermediate network
|
||||||
protocol implemented in the kernel, e.g. tcpdump. If you want them
|
protocol implemented in the kernel, e.g. tcpdump. If you want them
|
||||||
to work, choose Y.
|
to work, choose Y.
|
||||||
|
|
||||||
This driver is also available as a module called af_packet.o ( =
|
This driver is also available as a module called af_packet.o ( =
|
||||||
code which can be inserted in and removed from the running kernel
|
code which can be inserted in and removed from the running kernel
|
||||||
whenever you want). If you want to compile it as a module, say M
|
whenever you want). If you want to compile it as a module, say M
|
||||||
here and read Documentation/modules.txt; if you use modprobe or
|
here and read Documentation/modules.txt; if you use modprobe or
|
||||||
kmod, you may also want to add "alias net-pf-17 af_packet" to
|
kmod, you may also want to add "alias net-pf-17 af_packet" to
|
||||||
/etc/modules.conf.
|
/etc/modules.conf.
|
||||||
|
|
||||||
and the note for the 2.2[.x] kernel says:
|
and the note for the 2.2[.x] kernel says:
|
||||||
@@ -47,7 +47,7 @@ In addition, there is an option that, in 2.2 and later kernels, will
|
|||||||
allow packet capture filters specified to programs such as tcpdump to be
|
allow packet capture filters specified to programs such as tcpdump to be
|
||||||
executed in the kernel, so that packets that don't pass the filter won't
|
executed in the kernel, so that packets that don't pass the filter won't
|
||||||
be copied from the kernel to the program, rather than having all packets
|
be copied from the kernel to the program, rather than having all packets
|
||||||
copied to the program and libpcap doing the filtering in user mode.
|
copied to the program and libpcap doing the filtering in user mode.
|
||||||
|
|
||||||
Copying packets from the kernel to the program consumes a significant
|
Copying packets from the kernel to the program consumes a significant
|
||||||
amount of CPU, so filtering in the kernel can reduce the overhead of
|
amount of CPU, so filtering in the kernel can reduce the overhead of
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ where DIR is the root of the Septel software distribution, for example
|
|||||||
/var/src/septel.
|
/var/src/septel.
|
||||||
|
|
||||||
By default (if you write only ./configure --with-septel) it takes
|
By default (if you write only ./configure --with-septel) it takes
|
||||||
./../septel as argument for DIR.
|
./../septel as argument for DIR.
|
||||||
|
|
||||||
If the Septel software is correctly detected 'configure' will
|
If the Septel software is correctly detected 'configure' will
|
||||||
report:
|
report:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
The following instructions are applicable to Tru64 UNIX
|
The following instructions are applicable to Tru64 UNIX
|
||||||
(formerly Digital UNIX (formerly DEC OSF/1)) version 4.0, and
|
(formerly Digital UNIX (formerly DEC OSF/1)) version 4.0, and
|
||||||
probably to later versions as well; at least some options apply to
|
probably to later versions as well; at least some options apply to
|
||||||
Digital UNIX 3.2 - perhaps all do.
|
Digital UNIX 3.2 - perhaps all do.
|
||||||
|
|||||||
10
libpcap/TODO
10
libpcap/TODO
@@ -6,11 +6,11 @@ Important stuff (to be done before the next release)
|
|||||||
|
|
||||||
General
|
General
|
||||||
|
|
||||||
- configure should not be in Git. Most open source projects have an
|
- configure should not be in Git. Most open source projects have an
|
||||||
autogen.sh script to run autoconf etc. after checkout. I think we
|
autogen.sh script to run autoconf etc. after checkout. I think we
|
||||||
should stick to the standard.
|
should stick to the standard.
|
||||||
|
|
||||||
- The source files should be better documented. There is no official
|
- The source files should be better documented. There is no official
|
||||||
design guideline for what is done where. There should be a common coding
|
design guideline for what is done where. There should be a common coding
|
||||||
style (okay, you can guess that by looking at the code) and a guide for
|
style (okay, you can guess that by looking at the code) and a guide for
|
||||||
what needs to be documented.
|
what needs to be documented.
|
||||||
@@ -18,7 +18,7 @@ General
|
|||||||
Less urgent items
|
Less urgent items
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
- Better documentation and cleanup of the interface. I am seeing a few
|
- Better documentation and cleanup of the interface. I am seeing a few
|
||||||
problems at the first glance which needs fixing:
|
problems at the first glance which needs fixing:
|
||||||
+ pcap_lookupnet makes little to no sense with protocols != IPv4
|
+ pcap_lookupnet makes little to no sense with protocols != IPv4
|
||||||
+ not very well suited for interactive programs (think ethereal). There
|
+ not very well suited for interactive programs (think ethereal). There
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.5.3
|
1.7.3
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/Gnuc.h,v 1.1 2002-08-01 08:33:05 risso Exp $ (LBL) */
|
|
||||||
|
|
||||||
/* Define __P() macro, if necessary */
|
/* Define __P() macro, if necessary */
|
||||||
|
|
||||||
#ifndef __P
|
#ifndef __P
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
|
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* 3. Neither the name of the project nor the names of its contributors
|
* 3. Neither the name of the project nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -27,8 +27,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: addrinfo.h,v 1.1 2002-08-01 08:33:05 risso Exp $ */
|
|
||||||
|
|
||||||
#ifndef HAVE_ADDRINFO
|
#ifndef HAVE_ADDRINFO
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -94,13 +92,13 @@ extern const char *inet_ntop (int, const void *, char *, size_t);
|
|||||||
|
|
||||||
#ifndef EAI_BADHINTS
|
#ifndef EAI_BADHINTS
|
||||||
#define EAI_BADHINTS 12
|
#define EAI_BADHINTS 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EAI_PROTOCOL
|
#ifndef EAI_PROTOCOL
|
||||||
#define EAI_PROTOCOL 13
|
#define EAI_PROTOCOL 13
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EAI_MAX
|
#ifndef EAI_MAX
|
||||||
#define EAI_MAX 14
|
#define EAI_MAX 14
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* -
|
* -
|
||||||
* Copyright (c) 1983, 1989, 1993
|
* Copyright (c) 1983, 1989, 1993
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -33,14 +33,14 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
* -
|
* -
|
||||||
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
* copyright notice and this permission notice appear in all copies, and that
|
* copyright notice and this permission notice appear in all copies, and that
|
||||||
* the name of Digital Equipment Corporation not be used in advertising or
|
* the name of Digital Equipment Corporation not be used in advertising or
|
||||||
* publicity pertaining to distribution of the document or software without
|
* publicity pertaining to distribution of the document or software without
|
||||||
* specific, written prior permission.
|
* specific, written prior permission.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
||||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
||||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#else
|
#else
|
||||||
#include <pcap-stdinc.h>
|
#include <pcap-stdinc.h>
|
||||||
#define __LITTLE_ENDIAN 1
|
#define __LITTLE_ENDIAN 1
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1999 WIDE Project.
|
* Copyright (C) 1999 WIDE Project.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* 3. Neither the name of the project nor the names of its contributors
|
* 3. Neither the name of the project nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -34,7 +34,7 @@ typedef unsigned char u_int8_t;
|
|||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
#endif /* HAVE_U_INT8_T */
|
#endif /* HAVE_U_INT8_T */
|
||||||
|
|
||||||
#ifndef HAVE_U_INT16_T
|
#ifndef HAVE_U_INT16_T
|
||||||
typedef unsigned short u_int16_t;
|
typedef unsigned short u_int16_t;
|
||||||
typedef signed short int16_t;
|
typedef signed short int16_t;
|
||||||
#endif /* HAVE_U_INT16_T */
|
#endif /* HAVE_U_INT16_T */
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1999 WIDE Project.
|
* Copyright (C) 1999 WIDE Project.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* 3. Neither the name of the project nor the names of its contributors
|
* 3. Neither the name of the project nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#ifndef _NET_IF_H_
|
#ifndef _NET_IF_H_
|
||||||
#define _NET_IF_H_
|
#define _NET_IF_H_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* <net/if.h> does not depend on <sys/time.h> on most other systems. This
|
* <net/if.h> does not depend on <sys/time.h> on most other systems. This
|
||||||
* helps userland compatability. (struct timeval ifi_lastchange)
|
* helps userland compatability. (struct timeval ifi_lastchange)
|
||||||
|
|||||||
@@ -57,7 +57,9 @@
|
|||||||
#ifndef _NETDB_H_
|
#ifndef _NETDB_H_
|
||||||
#define _NETDB_H_
|
#define _NETDB_H_
|
||||||
|
|
||||||
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
|
/* MingW64 defines _POSIX_THREAD_SAFE_FUNCTIONS.
|
||||||
|
*/
|
||||||
|
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT) && !defined(__MINGW64_VERSION_MAJOR)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1999 WIDE Project.
|
* Copyright (C) 1999 WIDE Project.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* 3. Neither the name of the project nor the names of its contributors
|
* 3. Neither the name of the project nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
|||||||
@@ -7,19 +7,19 @@
|
|||||||
CFG=libpcap - Win32 Debug
|
CFG=libpcap - Win32 Debug
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE use the Export Makefile command and run
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libpcap.mak".
|
!MESSAGE NMAKE /f "libpcap.mak".
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libpcap.mak" CFG="libpcap - Win32 Debug"
|
!MESSAGE NMAKE /f "libpcap.mak" CFG="libpcap - Win32 Debug"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "libpcap - Win32 Release" (based on "Win32 (x86) Static Library")
|
!MESSAGE "libpcap - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE "libpcap - Win32 Debug" (based on "Win32 (x86) Static Library")
|
!MESSAGE "libpcap - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
# PROP AllowPerConfigDependencies 0
|
# PROP AllowPerConfigDependencies 0
|
||||||
@@ -74,7 +74,7 @@ LIB32=link.exe -lib
|
|||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo
|
# ADD LIB32 /nologo
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static char *ai_errlist[] = {
|
|||||||
#define EAI_MAX (sizeof(ai_errlist)/sizeof(ai_errlist[0]))
|
#define EAI_MAX (sizeof(ai_errlist)/sizeof(ai_errlist[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* on MingW, gai_strerror is available.
|
/* on MingW, gai_strerror is available.
|
||||||
We need to compile gai_strerrorA only for Cygwin
|
We need to compile gai_strerrorA only for Cygwin
|
||||||
*/
|
*/
|
||||||
#ifndef gai_strerror
|
#ifndef gai_strerror
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* 3. Neither the name of the project nor the names of its contributors
|
* 3. Neither the name of the project nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -49,15 +49,10 @@
|
|||||||
* Mingw64 has its own implementation of getaddrinfo, mingw32 no
|
* Mingw64 has its own implementation of getaddrinfo, mingw32 no
|
||||||
*/
|
*/
|
||||||
#ifndef __MINGW64__
|
#ifndef __MINGW64__
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/Win32/Src/getaddrinfo.c,v 1.3 2008-09-15 23:37:51 guy Exp $";
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <pcap-stdinc.h>
|
#include <pcap-stdinc.h>
|
||||||
@@ -76,17 +71,17 @@ static const char rcsid[] _U_ =
|
|||||||
|
|
||||||
#ifndef HAVE_PORTABLE_PROTOTYPE
|
#ifndef HAVE_PORTABLE_PROTOTYPE
|
||||||
#include "cdecl_ext.h"
|
#include "cdecl_ext.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_U_INT32_T
|
#ifndef HAVE_U_INT32_T
|
||||||
#include "bittypes.h"
|
#include "bittypes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_SOCKADDR_STORAGE
|
#ifndef HAVE_SOCKADDR_STORAGE
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
#include "sockstorage.h"
|
#include "sockstorage.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NEED_ADDRINFO_H
|
#ifdef NEED_ADDRINFO_H
|
||||||
#include "addrinfo.h"
|
#include "addrinfo.h"
|
||||||
@@ -114,7 +109,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 };
|
|||||||
static const char in6_addrany[] = {
|
static const char in6_addrany[] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
};
|
};
|
||||||
static const char in_loopback[] = { 127, 0, 0, 1 };
|
static const char in_loopback[] = { 127, 0, 0, 1 };
|
||||||
static const char in6_loopback[] = {
|
static const char in6_loopback[] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
|
||||||
};
|
};
|
||||||
@@ -132,7 +127,7 @@ static const struct afd {
|
|||||||
int a_socklen;
|
int a_socklen;
|
||||||
int a_off;
|
int a_off;
|
||||||
const char *a_addrany;
|
const char *a_addrany;
|
||||||
const char *a_loopback;
|
const char *a_loopback;
|
||||||
int a_scoped;
|
int a_scoped;
|
||||||
} afdl [] = {
|
} afdl [] = {
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
@@ -335,7 +330,7 @@ getaddrinfo(hostname, servname, hints, res)
|
|||||||
pai->ai_canonname = NULL;
|
pai->ai_canonname = NULL;
|
||||||
pai->ai_addr = NULL;
|
pai->ai_addr = NULL;
|
||||||
pai->ai_next = NULL;
|
pai->ai_next = NULL;
|
||||||
|
|
||||||
if (hostname == NULL && servname == NULL)
|
if (hostname == NULL && servname == NULL)
|
||||||
return EAI_NONAME;
|
return EAI_NONAME;
|
||||||
if (hints) {
|
if (hints) {
|
||||||
@@ -825,7 +820,7 @@ explore_numeric(pai, hostname, servname, res)
|
|||||||
}
|
}
|
||||||
while (cur && cur->ai_next)
|
while (cur && cur->ai_next)
|
||||||
cur = cur->ai_next;
|
cur = cur->ai_next;
|
||||||
} else
|
} else
|
||||||
ERR(EAI_FAMILY); /*xxx*/
|
ERR(EAI_FAMILY); /*xxx*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,7 +955,7 @@ get_name(addr, afd, res, numaddr, pai, servname)
|
|||||||
GET_AI(cur, afd, numaddr);
|
GET_AI(cur, afd, numaddr);
|
||||||
GET_PORT(cur, servname);
|
GET_PORT(cur, servname);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_GETIPNODEBY
|
#ifdef USE_GETIPNODEBY
|
||||||
if (hp)
|
if (hp)
|
||||||
freehostent(hp);
|
freehostent(hp);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ again:
|
|||||||
net.n_net = inet_network(cp);
|
net.n_net = inet_network(cp);
|
||||||
net.n_addrtype = AF_INET;
|
net.n_addrtype = AF_INET;
|
||||||
q = net.n_aliases = net_aliases;
|
q = net.n_aliases = net_aliases;
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
cp = p;
|
cp = p;
|
||||||
while (cp && *cp) {
|
while (cp && *cp) {
|
||||||
if (*cp == ' ' || *cp == '\t') {
|
if (*cp == ' ' || *cp == '\t') {
|
||||||
|
|||||||
@@ -2,27 +2,27 @@
|
|||||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgement:
|
||||||
* This product includes software developed by the Kungliga Tekniska
|
* This product includes software developed by the Kungliga Tekniska
|
||||||
* H<>gskolan and its contributors.
|
* H<>gskolan and its contributors.
|
||||||
*
|
*
|
||||||
* 4. Neither the name of the Institute nor the names of its contributors
|
* 4. Neither the name of the Institute nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -36,13 +36,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: inet_aton.c,v 1.2 2003-11-15 23:24:06 guy Exp $ */
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/Win32/Src/inet_aton.c,v 1.2 2003-11-15 23:24:06 guy Exp $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <pcap-stdinc.h>
|
#include <pcap-stdinc.h>
|
||||||
|
|
||||||
|
|||||||
@@ -2,27 +2,27 @@
|
|||||||
* Copyright (c) 1999 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1999 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgement:
|
||||||
* This product includes software developed by the Kungliga Tekniska
|
* This product includes software developed by the Kungliga Tekniska
|
||||||
* H<>gskolan and its contributors.
|
* H<>gskolan and its contributors.
|
||||||
*
|
*
|
||||||
* 4. Neither the name of the Institute nor the names of its contributors
|
* 4. Neither the name of the Institute nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -36,13 +36,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: inet_pton.c,v 1.3 2007-09-27 18:02:20 gianluca Exp $ */
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/Win32/Src/inet_pton.c,v 1.3 2007-09-27 18:02:20 gianluca Exp $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
6
libpcap/aclocal.m4
vendored
6
libpcap/aclocal.m4
vendored
@@ -1,5 +1,3 @@
|
|||||||
dnl @(#) $Header: /tcpdump/master/libpcap/aclocal.m4,v 1.93 2008-11-18 07:29:48 guy Exp $ (LBL)
|
|
||||||
dnl
|
|
||||||
dnl Copyright (c) 1995, 1996, 1997, 1998
|
dnl Copyright (c) 1995, 1996, 1997, 1998
|
||||||
dnl The Regents of the University of California. All rights reserved.
|
dnl The Regents of the University of California. All rights reserved.
|
||||||
dnl
|
dnl
|
||||||
@@ -233,7 +231,7 @@ AC_DEFUN(AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR,
|
|||||||
# We're assuming this is clang, where
|
# We're assuming this is clang, where
|
||||||
# -Werror=unknown-warning-option is the appropriate
|
# -Werror=unknown-warning-option is the appropriate
|
||||||
# option to force the compiler to fail.
|
# option to force the compiler to fail.
|
||||||
#
|
#
|
||||||
ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option"
|
ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -1276,7 +1274,7 @@ dnl
|
|||||||
dnl AC_LBL_DL_PASSIVE_REQ_T
|
dnl AC_LBL_DL_PASSIVE_REQ_T
|
||||||
dnl
|
dnl
|
||||||
dnl results:
|
dnl results:
|
||||||
dnl
|
dnl
|
||||||
dnl HAVE_DLPI_PASSIVE (defined)
|
dnl HAVE_DLPI_PASSIVE (defined)
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(AC_LBL_DL_PASSIVE_REQ_T,
|
AC_DEFUN(AC_LBL_DL_PASSIVE_REQ_T,
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#) $Id: arcnet.h,v 1.2 2001-04-24 02:17:52 guy Exp $ (LBL)
|
|
||||||
*
|
|
||||||
* from: NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp
|
* from: NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/atmuni31.h,v 1.3 2007-10-22 19:28:58 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Based on UNI3.1 standard by ATM Forum */
|
/* Based on UNI3.1 standard by ATM Forum */
|
||||||
|
|||||||
@@ -38,11 +38,6 @@
|
|||||||
* @(#)bpf.c 7.5 (Berkeley) 7/15/91
|
* @(#)bpf.c 7.5 (Berkeley) 7/15/91
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !(defined(lint) || defined(KERNEL) || defined(_KERNEL))
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/bpf/net/bpf_filter.c,v 1.46 2008-01-02 04:16:46 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -200,23 +195,39 @@ m_xhalf(m, k, err)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/if_packet.h>
|
||||||
|
#include <linux/filter.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum {
|
||||||
|
BPF_S_ANC_NONE,
|
||||||
|
BPF_S_ANC_VLAN_TAG,
|
||||||
|
BPF_S_ANC_VLAN_TAG_PRESENT,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Execute the filter program starting at pc on the packet p
|
* Execute the filter program starting at pc on the packet p
|
||||||
* wirelen is the length of the original packet
|
* wirelen is the length of the original packet
|
||||||
* buflen is the amount of data present
|
* buflen is the amount of data present
|
||||||
|
* aux_data is auxiliary data, currently used only when interpreting
|
||||||
|
* filters intended for the Linux kernel in cases where the kernel
|
||||||
|
* rejects the filter; it contains VLAN tag information
|
||||||
* For the kernel, p is assumed to be a pointer to an mbuf if buflen is 0,
|
* For the kernel, p is assumed to be a pointer to an mbuf if buflen is 0,
|
||||||
* in all other cases, p is a pointer to a buffer and buflen is its size.
|
* in all other cases, p is a pointer to a buffer and buflen is its size.
|
||||||
*/
|
*/
|
||||||
u_int
|
u_int
|
||||||
bpf_filter(pc, p, wirelen, buflen)
|
bpf_filter_with_aux_data(pc, p, wirelen, buflen, aux_data)
|
||||||
register const struct bpf_insn *pc;
|
register const struct bpf_insn *pc;
|
||||||
register const u_char *p;
|
register const u_char *p;
|
||||||
u_int wirelen;
|
u_int wirelen;
|
||||||
register u_int buflen;
|
register u_int buflen;
|
||||||
|
register const struct bpf_aux_data *aux_data;
|
||||||
{
|
{
|
||||||
register u_int32 A, X;
|
register u_int32 A, X;
|
||||||
register int k;
|
register bpf_u_int32 k;
|
||||||
int32 mem[BPF_MEMWORDS];
|
u_int32 mem[BPF_MEMWORDS];
|
||||||
#if defined(KERNEL) || defined(_KERNEL)
|
#if defined(KERNEL) || defined(_KERNEL)
|
||||||
struct mbuf *m, *n;
|
struct mbuf *m, *n;
|
||||||
int merr, len;
|
int merr, len;
|
||||||
@@ -255,7 +266,7 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
|
|
||||||
case BPF_LD|BPF_W|BPF_ABS:
|
case BPF_LD|BPF_W|BPF_ABS:
|
||||||
k = pc->k;
|
k = pc->k;
|
||||||
if (k + sizeof(int32) > buflen) {
|
if (k > buflen || sizeof(int32_t) > buflen - k) {
|
||||||
#if defined(KERNEL) || defined(_KERNEL)
|
#if defined(KERNEL) || defined(_KERNEL)
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -272,7 +283,7 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
|
|
||||||
case BPF_LD|BPF_H|BPF_ABS:
|
case BPF_LD|BPF_H|BPF_ABS:
|
||||||
k = pc->k;
|
k = pc->k;
|
||||||
if (k + sizeof(short) > buflen) {
|
if (k > buflen || sizeof(int16_t) > buflen - k) {
|
||||||
#if defined(KERNEL) || defined(_KERNEL)
|
#if defined(KERNEL) || defined(_KERNEL)
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -288,22 +299,50 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case BPF_LD|BPF_B|BPF_ABS:
|
case BPF_LD|BPF_B|BPF_ABS:
|
||||||
k = pc->k;
|
{
|
||||||
if (k >= buflen) {
|
#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
|
||||||
#if defined(KERNEL) || defined(_KERNEL)
|
int code = BPF_S_ANC_NONE;
|
||||||
if (m == NULL)
|
#define ANCILLARY(CODE) case SKF_AD_OFF + SKF_AD_##CODE: \
|
||||||
return 0;
|
code = BPF_S_ANC_##CODE; \
|
||||||
n = m;
|
if (!aux_data) \
|
||||||
MINDEX(len, n, k);
|
return 0; \
|
||||||
A = mtod(n, u_char *)[k];
|
break;
|
||||||
continue;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
A = p[k];
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
switch (pc->k) {
|
||||||
|
ANCILLARY(VLAN_TAG);
|
||||||
|
ANCILLARY(VLAN_TAG_PRESENT);
|
||||||
|
default :
|
||||||
|
#endif
|
||||||
|
k = pc->k;
|
||||||
|
if (k >= buflen) {
|
||||||
|
#if defined(KERNEL) || defined(_KERNEL)
|
||||||
|
if (m == NULL)
|
||||||
|
return 0;
|
||||||
|
n = m;
|
||||||
|
MINDEX(len, n, k);
|
||||||
|
A = mtod(n, u_char *)[k];
|
||||||
|
continue;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
A = p[k];
|
||||||
|
#if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT)
|
||||||
|
}
|
||||||
|
switch (code) {
|
||||||
|
case BPF_S_ANC_VLAN_TAG:
|
||||||
|
if (aux_data)
|
||||||
|
A = aux_data->vlan_tag;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BPF_S_ANC_VLAN_TAG_PRESENT:
|
||||||
|
if (aux_data)
|
||||||
|
A = aux_data->vlan_tag_present;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
continue;
|
||||||
|
}
|
||||||
case BPF_LD|BPF_W|BPF_LEN:
|
case BPF_LD|BPF_W|BPF_LEN:
|
||||||
A = wirelen;
|
A = wirelen;
|
||||||
continue;
|
continue;
|
||||||
@@ -314,7 +353,8 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
|
|
||||||
case BPF_LD|BPF_W|BPF_IND:
|
case BPF_LD|BPF_W|BPF_IND:
|
||||||
k = X + pc->k;
|
k = X + pc->k;
|
||||||
if (k + sizeof(int32) > buflen) {
|
if (pc->k > buflen || X > buflen - pc->k ||
|
||||||
|
sizeof(int32_t) > buflen - k) {
|
||||||
#if defined(KERNEL) || defined(_KERNEL)
|
#if defined(KERNEL) || defined(_KERNEL)
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -331,7 +371,8 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
|
|
||||||
case BPF_LD|BPF_H|BPF_IND:
|
case BPF_LD|BPF_H|BPF_IND:
|
||||||
k = X + pc->k;
|
k = X + pc->k;
|
||||||
if (k + sizeof(short) > buflen) {
|
if (X > buflen || pc->k > buflen - X ||
|
||||||
|
sizeof(int16_t) > buflen - k) {
|
||||||
#if defined(KERNEL) || defined(_KERNEL)
|
#if defined(KERNEL) || defined(_KERNEL)
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -348,7 +389,7 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
|
|
||||||
case BPF_LD|BPF_B|BPF_IND:
|
case BPF_LD|BPF_B|BPF_IND:
|
||||||
k = X + pc->k;
|
k = X + pc->k;
|
||||||
if (k >= buflen) {
|
if (pc->k >= buflen || X >= buflen - pc->k) {
|
||||||
#if defined(KERNEL) || defined(_KERNEL)
|
#if defined(KERNEL) || defined(_KERNEL)
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -469,6 +510,12 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
A /= X;
|
A /= X;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_MOD|BPF_X:
|
||||||
|
if (X == 0)
|
||||||
|
return 0;
|
||||||
|
A %= X;
|
||||||
|
continue;
|
||||||
|
|
||||||
case BPF_ALU|BPF_AND|BPF_X:
|
case BPF_ALU|BPF_AND|BPF_X:
|
||||||
A &= X;
|
A &= X;
|
||||||
continue;
|
continue;
|
||||||
@@ -477,6 +524,10 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
A |= X;
|
A |= X;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_XOR|BPF_X:
|
||||||
|
A ^= X;
|
||||||
|
continue;
|
||||||
|
|
||||||
case BPF_ALU|BPF_LSH|BPF_X:
|
case BPF_ALU|BPF_LSH|BPF_X:
|
||||||
A <<= X;
|
A <<= X;
|
||||||
continue;
|
continue;
|
||||||
@@ -501,6 +552,10 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
A /= pc->k;
|
A /= pc->k;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_MOD|BPF_K:
|
||||||
|
A %= pc->k;
|
||||||
|
continue;
|
||||||
|
|
||||||
case BPF_ALU|BPF_AND|BPF_K:
|
case BPF_ALU|BPF_AND|BPF_K:
|
||||||
A &= pc->k;
|
A &= pc->k;
|
||||||
continue;
|
continue;
|
||||||
@@ -509,6 +564,10 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
A |= pc->k;
|
A |= pc->k;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_XOR|BPF_K:
|
||||||
|
A ^= pc->k;
|
||||||
|
continue;
|
||||||
|
|
||||||
case BPF_ALU|BPF_LSH|BPF_K:
|
case BPF_ALU|BPF_LSH|BPF_K:
|
||||||
A <<= pc->k;
|
A <<= pc->k;
|
||||||
continue;
|
continue;
|
||||||
@@ -532,6 +591,17 @@ bpf_filter(pc, p, wirelen, buflen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u_int
|
||||||
|
bpf_filter(pc, p, wirelen, buflen)
|
||||||
|
register const struct bpf_insn *pc;
|
||||||
|
register const u_char *p;
|
||||||
|
u_int wirelen;
|
||||||
|
register u_int buflen;
|
||||||
|
{
|
||||||
|
return bpf_filter_with_aux_data(pc, p, wirelen, buflen, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return true if the 'fcode' is a valid filter program.
|
* Return true if the 'fcode' is a valid filter program.
|
||||||
* The constraints are that each jump be forward and to a valid
|
* The constraints are that each jump be forward and to a valid
|
||||||
@@ -611,13 +681,16 @@ bpf_validate(f, len)
|
|||||||
case BPF_MUL:
|
case BPF_MUL:
|
||||||
case BPF_OR:
|
case BPF_OR:
|
||||||
case BPF_AND:
|
case BPF_AND:
|
||||||
|
case BPF_XOR:
|
||||||
case BPF_LSH:
|
case BPF_LSH:
|
||||||
case BPF_RSH:
|
case BPF_RSH:
|
||||||
case BPF_NEG:
|
case BPF_NEG:
|
||||||
break;
|
break;
|
||||||
case BPF_DIV:
|
case BPF_DIV:
|
||||||
|
case BPF_MOD:
|
||||||
/*
|
/*
|
||||||
* Check for constant division by 0.
|
* Check for constant division or modulus
|
||||||
|
* by 0.
|
||||||
*/
|
*/
|
||||||
if (BPF_SRC(p->code) == BPF_K && p->k == 0)
|
if (BPF_SRC(p->code) == BPF_K && p->k == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -18,10 +18,6 @@
|
|||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/bpf_dump.c,v 1.15 2008-01-02 04:16:46 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/bpf_image.c,v 1.28 2008-01-02 04:16:46 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -216,6 +211,11 @@ bpf_image(p, n)
|
|||||||
fmt = "x";
|
fmt = "x";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_MOD|BPF_X:
|
||||||
|
op = "mod";
|
||||||
|
fmt = "x";
|
||||||
|
break;
|
||||||
|
|
||||||
case BPF_ALU|BPF_AND|BPF_X:
|
case BPF_ALU|BPF_AND|BPF_X:
|
||||||
op = "and";
|
op = "and";
|
||||||
fmt = "x";
|
fmt = "x";
|
||||||
@@ -226,6 +226,11 @@ bpf_image(p, n)
|
|||||||
fmt = "x";
|
fmt = "x";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_XOR|BPF_X:
|
||||||
|
op = "xor";
|
||||||
|
fmt = "x";
|
||||||
|
break;
|
||||||
|
|
||||||
case BPF_ALU|BPF_LSH|BPF_X:
|
case BPF_ALU|BPF_LSH|BPF_X:
|
||||||
op = "lsh";
|
op = "lsh";
|
||||||
fmt = "x";
|
fmt = "x";
|
||||||
@@ -256,6 +261,11 @@ bpf_image(p, n)
|
|||||||
fmt = "#%d";
|
fmt = "#%d";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_MOD|BPF_K:
|
||||||
|
op = "mod";
|
||||||
|
fmt = "#%d";
|
||||||
|
break;
|
||||||
|
|
||||||
case BPF_ALU|BPF_AND|BPF_K:
|
case BPF_ALU|BPF_AND|BPF_K:
|
||||||
op = "and";
|
op = "and";
|
||||||
fmt = "#0x%x";
|
fmt = "#0x%x";
|
||||||
@@ -266,6 +276,11 @@ bpf_image(p, n)
|
|||||||
fmt = "#0x%x";
|
fmt = "#0x%x";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BPF_ALU|BPF_XOR|BPF_K:
|
||||||
|
op = "xor";
|
||||||
|
fmt = "#0x%x";
|
||||||
|
break;
|
||||||
|
|
||||||
case BPF_ALU|BPF_LSH|BPF_K:
|
case BPF_ALU|BPF_LSH|BPF_K:
|
||||||
op = "lsh";
|
op = "lsh";
|
||||||
fmt = "#%d";
|
fmt = "#%d";
|
||||||
|
|||||||
587
libpcap/config.guess
vendored
587
libpcap/config.guess
vendored
@@ -1,14 +1,12 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Attempt to guess a canonical system name.
|
# Attempt to guess a canonical system name.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
timestamp='2009-12-30'
|
timestamp='2015-02-23'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful, but
|
# This program is distributed in the hope that it will be useful, but
|
||||||
@@ -17,26 +15,22 @@ timestamp='2009-12-30'
|
|||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
#
|
#
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
# configuration script generated by Autoconf, you may include it under
|
# configuration script generated by Autoconf, you may include it under
|
||||||
# the same distribution terms that you use for the rest of that program.
|
# the same distribution terms that you use for the rest of that
|
||||||
|
# program. This Exception is an additional permission under section 7
|
||||||
|
# of the GNU General Public License, version 3 ("GPLv3").
|
||||||
# Originally written by Per Bothner. Please send patches (context
|
|
||||||
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
|
||||||
# entry.
|
|
||||||
#
|
#
|
||||||
# This script attempts to guess a canonical system name similar to
|
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
|
||||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
|
||||||
# exits with 0. Otherwise, it exits with 1.
|
|
||||||
#
|
#
|
||||||
# You can get the latest version of this script from:
|
# You can get the latest version of this script from:
|
||||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||||
|
#
|
||||||
|
# Please send patches to <config-patches@gnu.org>.
|
||||||
|
|
||||||
|
|
||||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||||
|
|
||||||
@@ -56,9 +50,7 @@ version="\
|
|||||||
GNU config.guess ($timestamp)
|
GNU config.guess ($timestamp)
|
||||||
|
|
||||||
Originally written by Per Bothner.
|
Originally written by Per Bothner.
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
Copyright 1992-2015 Free Software Foundation, Inc.
|
||||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
|
||||||
Software Foundation, Inc.
|
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
|||||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||||
|
|
||||||
|
case "${UNAME_SYSTEM}" in
|
||||||
|
Linux|GNU|GNU/*)
|
||||||
|
# If the system lacks a compiler, then just pick glibc.
|
||||||
|
# We could probably try harder.
|
||||||
|
LIBC=gnu
|
||||||
|
|
||||||
|
eval $set_cc_for_build
|
||||||
|
cat <<-EOF > $dummy.c
|
||||||
|
#include <features.h>
|
||||||
|
#if defined(__UCLIBC__)
|
||||||
|
LIBC=uclibc
|
||||||
|
#elif defined(__dietlibc__)
|
||||||
|
LIBC=dietlibc
|
||||||
|
#else
|
||||||
|
LIBC=gnu
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Note: order is significant - the case branches are not exclusive.
|
# Note: order is significant - the case branches are not exclusive.
|
||||||
|
|
||||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
*:NetBSD:*:*)
|
*:NetBSD:*:*)
|
||||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||||
# switched to ELF, *-*-netbsd* would select the old
|
# switched to ELF, *-*-netbsd* would select the old
|
||||||
# object file format. This provides both forward
|
# object file format. This provides both forward
|
||||||
@@ -155,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# Note: NetBSD doesn't particularly care about the vendor
|
# Note: NetBSD doesn't particularly care about the vendor
|
||||||
# portion of the name. We always set it to "unknown".
|
# portion of the name. We always set it to "unknown".
|
||||||
sysctl="sysctl -n hw.machine_arch"
|
sysctl="sysctl -n hw.machine_arch"
|
||||||
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
|
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
|
||||||
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
|
/sbin/$sysctl 2>/dev/null || \
|
||||||
|
/usr/sbin/$sysctl 2>/dev/null || \
|
||||||
|
echo unknown)`
|
||||||
case "${UNAME_MACHINE_ARCH}" in
|
case "${UNAME_MACHINE_ARCH}" in
|
||||||
armeb) machine=armeb-unknown ;;
|
armeb) machine=armeb-unknown ;;
|
||||||
arm*) machine=arm-unknown ;;
|
arm*) machine=arm-unknown ;;
|
||||||
sh3el) machine=shl-unknown ;;
|
sh3el) machine=shl-unknown ;;
|
||||||
sh3eb) machine=sh-unknown ;;
|
sh3eb) machine=sh-unknown ;;
|
||||||
sh5el) machine=sh5le-unknown ;;
|
sh5el) machine=sh5le-unknown ;;
|
||||||
|
earmv*)
|
||||||
|
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
|
||||||
|
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
|
||||||
|
machine=${arch}${endian}-unknown
|
||||||
|
;;
|
||||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||||
esac
|
esac
|
||||||
# The Operating System including object format, if it has switched
|
# The Operating System including object format, if it has switched
|
||||||
# to ELF recently, or will in the future.
|
# to ELF recently, or will in the future.
|
||||||
case "${UNAME_MACHINE_ARCH}" in
|
case "${UNAME_MACHINE_ARCH}" in
|
||||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
| grep -q __ELF__
|
| grep -q __ELF__
|
||||||
@@ -181,7 +201,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
os=netbsd
|
os=netbsd
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Determine ABI tags.
|
||||||
|
case "${UNAME_MACHINE_ARCH}" in
|
||||||
|
earm*)
|
||||||
|
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
|
||||||
|
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# The OS release
|
# The OS release
|
||||||
@@ -200,7 +227,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
|
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
|
||||||
# contains redundant information, the shorter form:
|
# contains redundant information, the shorter form:
|
||||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||||
echo "${machine}-${os}${release}"
|
echo "${machine}-${os}${release}${abi}"
|
||||||
|
exit ;;
|
||||||
|
*:Bitrig:*:*)
|
||||||
|
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||||
|
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:OpenBSD:*:*)
|
*:OpenBSD:*:*)
|
||||||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||||
@@ -224,7 +255,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||||
;;
|
;;
|
||||||
*5.*)
|
*5.*)
|
||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||||
@@ -270,7 +301,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# A Xn.n version is an unreleased experimental baselevel.
|
# A Xn.n version is an unreleased experimental baselevel.
|
||||||
# 1.2 uses "1.2" for uname -r.
|
# 1.2 uses "1.2" for uname -r.
|
||||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
exit ;;
|
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||||
|
exitcode=$?
|
||||||
|
trap '' 0
|
||||||
|
exit $exitcode ;;
|
||||||
Alpha\ *:Windows_NT*:*)
|
Alpha\ *:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||||
@@ -296,12 +330,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
echo s390-ibm-zvmoe
|
echo s390-ibm-zvmoe
|
||||||
exit ;;
|
exit ;;
|
||||||
*:OS400:*:*)
|
*:OS400:*:*)
|
||||||
echo powerpc-ibm-os400
|
echo powerpc-ibm-os400
|
||||||
exit ;;
|
exit ;;
|
||||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
arm:riscos:*:*|arm:RISCOS:*:*)
|
arm*:riscos:*:*|arm*:RISCOS:*:*)
|
||||||
echo arm-unknown-riscos
|
echo arm-unknown-riscos
|
||||||
exit ;;
|
exit ;;
|
||||||
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
|
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
|
||||||
@@ -395,23 +429,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# MiNT. But MiNT is downward compatible to TOS, so this should
|
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||||
# be no problem.
|
# be no problem.
|
||||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||||
echo m68k-milan-mint${UNAME_RELEASE}
|
echo m68k-milan-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||||
echo m68k-hades-mint${UNAME_RELEASE}
|
echo m68k-hades-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
m68k:machten:*:*)
|
m68k:machten:*:*)
|
||||||
echo m68k-apple-machten${UNAME_RELEASE}
|
echo m68k-apple-machten${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -481,8 +515,8 @@ EOF
|
|||||||
echo m88k-motorola-sysv3
|
echo m88k-motorola-sysv3
|
||||||
exit ;;
|
exit ;;
|
||||||
AViiON:dgux:*:*)
|
AViiON:dgux:*:*)
|
||||||
# DG/UX returns AViiON for all architectures
|
# DG/UX returns AViiON for all architectures
|
||||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
||||||
then
|
then
|
||||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||||
@@ -495,7 +529,7 @@ EOF
|
|||||||
else
|
else
|
||||||
echo i586-dg-dgux${UNAME_RELEASE}
|
echo i586-dg-dgux${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||||
echo m88k-dolphin-sysv3
|
echo m88k-dolphin-sysv3
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -552,15 +586,16 @@ EOF
|
|||||||
echo rs6000-ibm-aix3.2
|
echo rs6000-ibm-aix3.2
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
*:AIX:*:[456])
|
*:AIX:*:[4567])
|
||||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||||
IBM_ARCH=rs6000
|
IBM_ARCH=rs6000
|
||||||
else
|
else
|
||||||
IBM_ARCH=powerpc
|
IBM_ARCH=powerpc
|
||||||
fi
|
fi
|
||||||
if [ -x /usr/bin/oslevel ] ; then
|
if [ -x /usr/bin/lslpp ] ; then
|
||||||
IBM_REV=`/usr/bin/oslevel`
|
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
|
||||||
|
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
|
||||||
else
|
else
|
||||||
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
|
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
@@ -595,52 +630,52 @@ EOF
|
|||||||
9000/[678][0-9][0-9])
|
9000/[678][0-9][0-9])
|
||||||
if [ -x /usr/bin/getconf ]; then
|
if [ -x /usr/bin/getconf ]; then
|
||||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||||
case "${sc_cpu_version}" in
|
case "${sc_cpu_version}" in
|
||||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||||
532) # CPU_PA_RISC2_0
|
532) # CPU_PA_RISC2_0
|
||||||
case "${sc_kernel_bits}" in
|
case "${sc_kernel_bits}" in
|
||||||
32) HP_ARCH="hppa2.0n" ;;
|
32) HP_ARCH="hppa2.0n" ;;
|
||||||
64) HP_ARCH="hppa2.0w" ;;
|
64) HP_ARCH="hppa2.0w" ;;
|
||||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||||
esac ;;
|
esac ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ "${HP_ARCH}" = "" ]; then
|
if [ "${HP_ARCH}" = "" ]; then
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
|
||||||
#define _HPUX_SOURCE
|
#define _HPUX_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
long bits = sysconf(_SC_KERNEL_BITS);
|
long bits = sysconf(_SC_KERNEL_BITS);
|
||||||
#endif
|
#endif
|
||||||
long cpu = sysconf (_SC_CPU_VERSION);
|
long cpu = sysconf (_SC_CPU_VERSION);
|
||||||
|
|
||||||
switch (cpu)
|
switch (cpu)
|
||||||
{
|
{
|
||||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||||
case CPU_PA_RISC2_0:
|
case CPU_PA_RISC2_0:
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
switch (bits)
|
switch (bits)
|
||||||
{
|
{
|
||||||
case 64: puts ("hppa2.0w"); break;
|
case 64: puts ("hppa2.0w"); break;
|
||||||
case 32: puts ("hppa2.0n"); break;
|
case 32: puts ("hppa2.0n"); break;
|
||||||
default: puts ("hppa2.0"); break;
|
default: puts ("hppa2.0"); break;
|
||||||
} break;
|
} break;
|
||||||
#else /* !defined(_SC_KERNEL_BITS) */
|
#else /* !defined(_SC_KERNEL_BITS) */
|
||||||
puts ("hppa2.0"); break;
|
puts ("hppa2.0"); break;
|
||||||
#endif
|
#endif
|
||||||
default: puts ("hppa1.0"); break;
|
default: puts ("hppa1.0"); break;
|
||||||
}
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||||
@@ -731,22 +766,22 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||||
echo c1-convex-bsd
|
echo c1-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||||
if getsysinfo -f scalar_acc
|
if getsysinfo -f scalar_acc
|
||||||
then echo c32-convex-bsd
|
then echo c32-convex-bsd
|
||||||
else echo c2-convex-bsd
|
else echo c2-convex-bsd
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||||
echo c34-convex-bsd
|
echo c34-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||||
echo c38-convex-bsd
|
echo c38-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||||
echo c4-convex-bsd
|
echo c4-convex-bsd
|
||||||
exit ;;
|
exit ;;
|
||||||
CRAY*Y-MP:*:*:*)
|
CRAY*Y-MP:*:*:*)
|
||||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -770,14 +805,14 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit ;;
|
exit ;;
|
||||||
5000:UNIX_System_V:4.*:*)
|
5000:UNIX_System_V:4.*:*)
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||||
@@ -789,30 +824,35 @@ EOF
|
|||||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:FreeBSD:*:*)
|
*:FreeBSD:*:*)
|
||||||
case ${UNAME_MACHINE} in
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
pc98)
|
case ${UNAME_PROCESSOR} in
|
||||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
|
||||||
amd64)
|
amd64)
|
||||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
*)
|
*)
|
||||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:CYGWIN*:*)
|
i*:CYGWIN*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-cygwin
|
echo ${UNAME_MACHINE}-pc-cygwin
|
||||||
exit ;;
|
exit ;;
|
||||||
|
*:MINGW64*:*)
|
||||||
|
echo ${UNAME_MACHINE}-pc-mingw64
|
||||||
|
exit ;;
|
||||||
*:MINGW*:*)
|
*:MINGW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-mingw32
|
echo ${UNAME_MACHINE}-pc-mingw32
|
||||||
exit ;;
|
exit ;;
|
||||||
|
*:MSYS*:*)
|
||||||
|
echo ${UNAME_MACHINE}-pc-msys
|
||||||
|
exit ;;
|
||||||
i*:windows32*:*)
|
i*:windows32*:*)
|
||||||
# uname -m includes "-pc" on this system.
|
# uname -m includes "-pc" on this system.
|
||||||
echo ${UNAME_MACHINE}-mingw32
|
echo ${UNAME_MACHINE}-mingw32
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:PW*:*)
|
i*:PW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-pw32
|
echo ${UNAME_MACHINE}-pc-pw32
|
||||||
exit ;;
|
exit ;;
|
||||||
*:Interix*:*)
|
*:Interix*:*)
|
||||||
case ${UNAME_MACHINE} in
|
case ${UNAME_MACHINE} in
|
||||||
x86)
|
x86)
|
||||||
echo i586-pc-interix${UNAME_RELEASE}
|
echo i586-pc-interix${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -849,15 +889,22 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
*:GNU:*:*)
|
*:GNU:*:*)
|
||||||
# the GNU system
|
# the GNU system
|
||||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||||
exit ;;
|
exit ;;
|
||||||
*:GNU/*:*:*)
|
*:GNU/*:*:*)
|
||||||
# other systems with GNU libc and userland
|
# other systems with GNU libc and userland
|
||||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:Minix:*:*)
|
i*86:Minix:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-minix
|
echo ${UNAME_MACHINE}-pc-minix
|
||||||
exit ;;
|
exit ;;
|
||||||
|
aarch64:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
aarch64_be:Linux:*:*)
|
||||||
|
UNAME_MACHINE=aarch64_be
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
alpha:Linux:*:*)
|
alpha:Linux:*:*)
|
||||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||||
@@ -867,52 +914,56 @@ EOF
|
|||||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||||
esac
|
esac
|
||||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
arc:Linux:*:* | arceb:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
arm*:Linux:*:*)
|
arm*:Linux:*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
| grep -q __ARM_EABI__
|
| grep -q __ARM_EABI__
|
||||||
then
|
then
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
else
|
else
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
|
| grep -q __ARM_PCS_VFP
|
||||||
|
then
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
|
||||||
|
else
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
avr32*:Linux:*:*)
|
avr32*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
cris:Linux:*:*)
|
cris:Linux:*:*)
|
||||||
echo cris-axis-linux-gnu
|
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
crisv32:Linux:*:*)
|
crisv32:Linux:*:*)
|
||||||
echo crisv32-axis-linux-gnu
|
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
frv:Linux:*:*)
|
frv:Linux:*:*)
|
||||||
echo frv-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
hexagon:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:Linux:*:*)
|
i*86:Linux:*:*)
|
||||||
LIBC=gnu
|
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#ifdef __dietlibc__
|
|
||||||
LIBC=dietlibc
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
|
||||||
exit ;;
|
exit ;;
|
||||||
ia64:Linux:*:*)
|
ia64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
m32r*:Linux:*:*)
|
m32r*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
m68*:Linux:*:*)
|
m68*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
mips:Linux:*:* | mips64:Linux:*:*)
|
mips:Linux:*:* | mips64:Linux:*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
@@ -931,51 +982,63 @@ EOF
|
|||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||||
;;
|
;;
|
||||||
or32:Linux:*:*)
|
openrisc*:Linux:*:*)
|
||||||
echo or32-unknown-linux-gnu
|
echo or1k-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
or32:Linux:*:* | or1k*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
padre:Linux:*:*)
|
padre:Linux:*:*)
|
||||||
echo sparc-unknown-linux-gnu
|
echo sparc-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||||
echo hppa64-unknown-linux-gnu
|
echo hppa64-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||||
# Look for CPU level
|
# Look for CPU level
|
||||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||||
PA7*) echo hppa1.1-unknown-linux-gnu ;;
|
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
|
||||||
PA8*) echo hppa2.0-unknown-linux-gnu ;;
|
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
|
||||||
*) echo hppa-unknown-linux-gnu ;;
|
*) echo hppa-unknown-linux-${LIBC} ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc64:Linux:*:*)
|
ppc64:Linux:*:*)
|
||||||
echo powerpc64-unknown-linux-gnu
|
echo powerpc64-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc:Linux:*:*)
|
ppc:Linux:*:*)
|
||||||
echo powerpc-unknown-linux-gnu
|
echo powerpc-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
ppc64le:Linux:*:*)
|
||||||
|
echo powerpc64le-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
ppcle:Linux:*:*)
|
||||||
|
echo powerpcle-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
s390:Linux:*:* | s390x:Linux:*:*)
|
s390:Linux:*:* | s390x:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-ibm-linux
|
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
sh64*:Linux:*:*)
|
sh64*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
sh*:Linux:*:*)
|
sh*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
|
exit ;;
|
||||||
|
tile*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
vax:Linux:*:*)
|
vax:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
x86_64:Linux:*:*)
|
x86_64:Linux:*:*)
|
||||||
echo x86_64-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
xtensa*:Linux:*:*)
|
xtensa*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:DYNIX/ptx:4*:*)
|
i*86:DYNIX/ptx:4*:*)
|
||||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||||
@@ -984,11 +1047,11 @@ EOF
|
|||||||
echo i386-sequent-sysv4
|
echo i386-sequent-sysv4
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:UNIX_SV:4.2MP:2.*)
|
i*86:UNIX_SV:4.2MP:2.*)
|
||||||
# Unixware is an offshoot of SVR4, but it has its own version
|
# Unixware is an offshoot of SVR4, but it has its own version
|
||||||
# number series starting with 2...
|
# number series starting with 2...
|
||||||
# I am not positive that other SVR4 systems won't match this,
|
# I am not positive that other SVR4 systems won't match this,
|
||||||
# I just have to hope. -- rms.
|
# I just have to hope. -- rms.
|
||||||
# Use sysv4.2uw... so that sysv4* matches it.
|
# Use sysv4.2uw... so that sysv4* matches it.
|
||||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:OS/2:*:*)
|
i*86:OS/2:*:*)
|
||||||
@@ -1020,7 +1083,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:*:5:[678]*)
|
i*86:*:5:[678]*)
|
||||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||||
case `/bin/uname -X | grep "^Machine"` in
|
case `/bin/uname -X | grep "^Machine"` in
|
||||||
*486*) UNAME_MACHINE=i486 ;;
|
*486*) UNAME_MACHINE=i486 ;;
|
||||||
*Pentium) UNAME_MACHINE=i586 ;;
|
*Pentium) UNAME_MACHINE=i586 ;;
|
||||||
@@ -1048,13 +1111,13 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
pc:*:*:*)
|
pc:*:*:*)
|
||||||
# Left here for compatibility:
|
# Left here for compatibility:
|
||||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||||
# the processor, so we play safe by assuming i586.
|
# the processor, so we play safe by assuming i586.
|
||||||
# Note: whatever this is, it MUST be the same as what config.sub
|
# Note: whatever this is, it MUST be the same as what config.sub
|
||||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||||
# this is a cross-build.
|
# this is a cross-build.
|
||||||
echo i586-pc-msdosdjgpp
|
echo i586-pc-msdosdjgpp
|
||||||
exit ;;
|
exit ;;
|
||||||
Intel:Mach:3*:*)
|
Intel:Mach:3*:*)
|
||||||
echo i386-pc-mach3
|
echo i386-pc-mach3
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1089,8 +1152,8 @@ EOF
|
|||||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||||
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
||||||
OS_REL='.3'
|
OS_REL='.3'
|
||||||
test -r /etc/.relid \
|
test -r /etc/.relid \
|
||||||
@@ -1133,10 +1196,10 @@ EOF
|
|||||||
echo ns32k-sni-sysv
|
echo ns32k-sni-sysv
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||||
echo i586-unisys-sysv4
|
echo i586-unisys-sysv4
|
||||||
exit ;;
|
exit ;;
|
||||||
*:UNIX_System_V:4*:FTX*)
|
*:UNIX_System_V:4*:FTX*)
|
||||||
# From Gerald Hewes <hewes@openmarket.com>.
|
# From Gerald Hewes <hewes@openmarket.com>.
|
||||||
# How about differentiating between stratus architectures? -djm
|
# How about differentiating between stratus architectures? -djm
|
||||||
@@ -1162,11 +1225,11 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||||
if [ -d /usr/nec ]; then
|
if [ -d /usr/nec ]; then
|
||||||
echo mips-nec-sysv${UNAME_RELEASE}
|
echo mips-nec-sysv${UNAME_RELEASE}
|
||||||
else
|
else
|
||||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||||
echo powerpc-be-beos
|
echo powerpc-be-beos
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1179,6 +1242,9 @@ EOF
|
|||||||
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||||
echo i586-pc-haiku
|
echo i586-pc-haiku
|
||||||
exit ;;
|
exit ;;
|
||||||
|
x86_64:Haiku:*:*)
|
||||||
|
echo x86_64-unknown-haiku
|
||||||
|
exit ;;
|
||||||
SX-4:SUPER-UX:*:*)
|
SX-4:SUPER-UX:*:*)
|
||||||
echo sx4-nec-superux${UNAME_RELEASE}
|
echo sx4-nec-superux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
@@ -1205,19 +1271,31 @@ EOF
|
|||||||
exit ;;
|
exit ;;
|
||||||
*:Darwin:*:*)
|
*:Darwin:*:*)
|
||||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||||
case $UNAME_PROCESSOR in
|
eval $set_cc_for_build
|
||||||
i386)
|
if test "$UNAME_PROCESSOR" = unknown ; then
|
||||||
eval $set_cc_for_build
|
UNAME_PROCESSOR=powerpc
|
||||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
fi
|
||||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||||
grep IS_64BIT_ARCH >/dev/null
|
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||||
then
|
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||||
UNAME_PROCESSOR="x86_64"
|
grep IS_64BIT_ARCH >/dev/null
|
||||||
fi
|
then
|
||||||
fi ;;
|
case $UNAME_PROCESSOR in
|
||||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||||
esac
|
powerpc) UNAME_PROCESSOR=powerpc64 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif test "$UNAME_PROCESSOR" = i386 ; then
|
||||||
|
# Avoid executing cc on OS X 10.9, as it ships with a stub
|
||||||
|
# that puts up a graphical alert prompting to install
|
||||||
|
# developer tools. Any system running Mac OS X 10.7 or
|
||||||
|
# later (Darwin 11 and later) is required to have a 64-bit
|
||||||
|
# processor. This is not true of the ARM version of Darwin
|
||||||
|
# that Apple uses in portable devices.
|
||||||
|
UNAME_PROCESSOR=x86_64
|
||||||
|
fi
|
||||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||||
@@ -1231,7 +1309,10 @@ EOF
|
|||||||
*:QNX:*:4*)
|
*:QNX:*:4*)
|
||||||
echo i386-pc-qnx
|
echo i386-pc-qnx
|
||||||
exit ;;
|
exit ;;
|
||||||
NSE-?:NONSTOP_KERNEL:*:*)
|
NEO-?:NONSTOP_KERNEL:*:*)
|
||||||
|
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
|
NSE-*:NONSTOP_KERNEL:*:*)
|
||||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
NSR-?:NONSTOP_KERNEL:*:*)
|
NSR-?:NONSTOP_KERNEL:*:*)
|
||||||
@@ -1276,13 +1357,13 @@ EOF
|
|||||||
echo pdp10-unknown-its
|
echo pdp10-unknown-its
|
||||||
exit ;;
|
exit ;;
|
||||||
SEI:*:*:SEIUX)
|
SEI:*:*:SEIUX)
|
||||||
echo mips-sei-seiux${UNAME_RELEASE}
|
echo mips-sei-seiux${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:DragonFly:*:*)
|
*:DragonFly:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
*:*VMS:*:*)
|
*:*VMS:*:*)
|
||||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||||
case "${UNAME_MACHINE}" in
|
case "${UNAME_MACHINE}" in
|
||||||
A*) echo alpha-dec-vms ; exit ;;
|
A*) echo alpha-dec-vms ; exit ;;
|
||||||
I*) echo ia64-dec-vms ; exit ;;
|
I*) echo ia64-dec-vms ; exit ;;
|
||||||
@@ -1300,159 +1381,11 @@ EOF
|
|||||||
i*86:AROS:*:*)
|
i*86:AROS:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-aros
|
echo ${UNAME_MACHINE}-pc-aros
|
||||||
exit ;;
|
exit ;;
|
||||||
|
x86_64:VMkernel:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-esx
|
||||||
|
exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
|
||||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
|
||||||
|
|
||||||
eval $set_cc_for_build
|
|
||||||
cat >$dummy.c <<EOF
|
|
||||||
#ifdef _SEQUENT_
|
|
||||||
# include <sys/types.h>
|
|
||||||
# include <sys/utsname.h>
|
|
||||||
#endif
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
#if defined (sony)
|
|
||||||
#if defined (MIPSEB)
|
|
||||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
|
||||||
I don't know.... */
|
|
||||||
printf ("mips-sony-bsd\n"); exit (0);
|
|
||||||
#else
|
|
||||||
#include <sys/param.h>
|
|
||||||
printf ("m68k-sony-newsos%s\n",
|
|
||||||
#ifdef NEWSOS4
|
|
||||||
"4"
|
|
||||||
#else
|
|
||||||
""
|
|
||||||
#endif
|
|
||||||
); exit (0);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
|
||||||
printf ("arm-acorn-riscix\n"); exit (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (hp300) && !defined (hpux)
|
|
||||||
printf ("m68k-hp-bsd\n"); exit (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (NeXT)
|
|
||||||
#if !defined (__ARCHITECTURE__)
|
|
||||||
#define __ARCHITECTURE__ "m68k"
|
|
||||||
#endif
|
|
||||||
int version;
|
|
||||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
|
||||||
if (version < 4)
|
|
||||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
|
||||||
else
|
|
||||||
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
|
|
||||||
exit (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (MULTIMAX) || defined (n16)
|
|
||||||
#if defined (UMAXV)
|
|
||||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
|
||||||
#else
|
|
||||||
#if defined (CMU)
|
|
||||||
printf ("ns32k-encore-mach\n"); exit (0);
|
|
||||||
#else
|
|
||||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (__386BSD__)
|
|
||||||
printf ("i386-pc-bsd\n"); exit (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (sequent)
|
|
||||||
#if defined (i386)
|
|
||||||
printf ("i386-sequent-dynix\n"); exit (0);
|
|
||||||
#endif
|
|
||||||
#if defined (ns32000)
|
|
||||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (_SEQUENT_)
|
|
||||||
struct utsname un;
|
|
||||||
|
|
||||||
uname(&un);
|
|
||||||
|
|
||||||
if (strncmp(un.version, "V2", 2) == 0) {
|
|
||||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
|
||||||
}
|
|
||||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
|
||||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
|
||||||
}
|
|
||||||
printf ("i386-sequent-ptx\n"); exit (0);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (vax)
|
|
||||||
# if !defined (ultrix)
|
|
||||||
# include <sys/param.h>
|
|
||||||
# if defined (BSD)
|
|
||||||
# if BSD == 43
|
|
||||||
printf ("vax-dec-bsd4.3\n"); exit (0);
|
|
||||||
# else
|
|
||||||
# if BSD == 199006
|
|
||||||
printf ("vax-dec-bsd4.3reno\n"); exit (0);
|
|
||||||
# else
|
|
||||||
printf ("vax-dec-bsd\n"); exit (0);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
printf ("vax-dec-bsd\n"); exit (0);
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
printf ("vax-dec-ultrix\n"); exit (0);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (alliant) && defined (i860)
|
|
||||||
printf ("i860-alliant-bsd\n"); exit (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
|
|
||||||
{ echo "$SYSTEM_NAME"; exit; }
|
|
||||||
|
|
||||||
# Apollos put the system type in the environment.
|
|
||||||
|
|
||||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
|
|
||||||
|
|
||||||
# Convex versions that predate uname can use getsysinfo(1)
|
|
||||||
|
|
||||||
if [ -x /usr/convex/getsysinfo ]
|
|
||||||
then
|
|
||||||
case `getsysinfo -f cpu_type` in
|
|
||||||
c1*)
|
|
||||||
echo c1-convex-bsd
|
|
||||||
exit ;;
|
|
||||||
c2*)
|
|
||||||
if getsysinfo -f scalar_acc
|
|
||||||
then echo c32-convex-bsd
|
|
||||||
else echo c2-convex-bsd
|
|
||||||
fi
|
|
||||||
exit ;;
|
|
||||||
c34*)
|
|
||||||
echo c34-convex-bsd
|
|
||||||
exit ;;
|
|
||||||
c38*)
|
|
||||||
echo c38-convex-bsd
|
|
||||||
exit ;;
|
|
||||||
c4*)
|
|
||||||
echo c4-convex-bsd
|
|
||||||
exit ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat >&2 <<EOF
|
cat >&2 <<EOF
|
||||||
$0: unable to guess system type
|
$0: unable to guess system type
|
||||||
|
|
||||||
|
|||||||
@@ -76,12 +76,18 @@
|
|||||||
/* Define to 1 if you have the <linux/ethtool.h> header file. */
|
/* Define to 1 if you have the <linux/ethtool.h> header file. */
|
||||||
#undef HAVE_LINUX_ETHTOOL_H
|
#undef HAVE_LINUX_ETHTOOL_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <linux/if_bonding.h> header file. */
|
||||||
|
#undef HAVE_LINUX_IF_BONDING_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <linux/if_packet.h> header file. */
|
/* Define to 1 if you have the <linux/if_packet.h> header file. */
|
||||||
#undef HAVE_LINUX_IF_PACKET_H
|
#undef HAVE_LINUX_IF_PACKET_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <linux/net_tstamp.h> header file. */
|
/* Define to 1 if you have the <linux/net_tstamp.h> header file. */
|
||||||
#undef HAVE_LINUX_NET_TSTAMP_H
|
#undef HAVE_LINUX_NET_TSTAMP_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <linux/sockios.h> header file. */
|
||||||
|
#undef HAVE_LINUX_SOCKIOS_H
|
||||||
|
|
||||||
/* if tp_vlan_tci exists */
|
/* if tp_vlan_tci exists */
|
||||||
#undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
|
#undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
|
||||||
|
|
||||||
@@ -256,6 +262,9 @@
|
|||||||
/* target host supports Bluetooth sniffing */
|
/* target host supports Bluetooth sniffing */
|
||||||
#undef PCAP_SUPPORT_BT
|
#undef PCAP_SUPPORT_BT
|
||||||
|
|
||||||
|
/* target host supports Bluetooth Monitor */
|
||||||
|
#undef PCAP_SUPPORT_BT_MONITOR
|
||||||
|
|
||||||
/* target host supports CAN sniffing */
|
/* target host supports CAN sniffing */
|
||||||
#undef PCAP_SUPPORT_CAN
|
#undef PCAP_SUPPORT_CAN
|
||||||
|
|
||||||
@@ -268,12 +277,12 @@
|
|||||||
/* target host supports netfilter sniffing */
|
/* target host supports netfilter sniffing */
|
||||||
#undef PCAP_SUPPORT_NETFILTER
|
#undef PCAP_SUPPORT_NETFILTER
|
||||||
|
|
||||||
|
/* use Linux packet ring capture if available */
|
||||||
|
#undef PCAP_SUPPORT_PACKET_RING
|
||||||
|
|
||||||
/* target host supports USB sniffing */
|
/* target host supports USB sniffing */
|
||||||
#undef PCAP_SUPPORT_USB
|
#undef PCAP_SUPPORT_USB
|
||||||
|
|
||||||
/* target host supports packet ring capture */
|
|
||||||
#undef PCAP_SUPPORT_PACKET_RING
|
|
||||||
|
|
||||||
/* include ACN support */
|
/* include ACN support */
|
||||||
#undef SITA
|
#undef SITA
|
||||||
|
|
||||||
|
|||||||
311
libpcap/config.sub
vendored
311
libpcap/config.sub
vendored
@@ -1,38 +1,31 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
timestamp='2009-12-31'
|
timestamp='2015-02-22'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# under the terms of the GNU General Public License as published by
|
||||||
# can handle that machine. It does not imply ALL GNU software can.
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
#
|
|
||||||
# This file is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful, but
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# GNU General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
#
|
#
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
# configuration script generated by Autoconf, you may include it under
|
# configuration script generated by Autoconf, you may include it under
|
||||||
# the same distribution terms that you use for the rest of that program.
|
# the same distribution terms that you use for the rest of that
|
||||||
|
# program. This Exception is an additional permission under section 7
|
||||||
|
# of the GNU General Public License, version 3 ("GPLv3").
|
||||||
|
|
||||||
|
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# Please send patches to <config-patches@gnu.org>.
|
||||||
# diff and a properly formatted GNU ChangeLog entry.
|
|
||||||
#
|
#
|
||||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||||
# Supply the specified configuration type as an argument.
|
# Supply the specified configuration type as an argument.
|
||||||
@@ -75,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
Copyright 1992-2015 Free Software Foundation, Inc.
|
||||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
|
||||||
Software Foundation, Inc.
|
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@@ -124,13 +115,18 @@ esac
|
|||||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||||
|
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
|
||||||
kopensolaris*-gnu* | \
|
kopensolaris*-gnu* | \
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
;;
|
;;
|
||||||
|
android-linux)
|
||||||
|
os=-linux-android
|
||||||
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||||
if [ $basic_machine != $1 ]
|
if [ $basic_machine != $1 ]
|
||||||
@@ -153,12 +149,12 @@ case $os in
|
|||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||||
-apple | -axis | -knuth | -cray | -microblaze)
|
-apple | -axis | -knuth | -cray | -microblaze*)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-bluegene*)
|
-bluegene*)
|
||||||
os=-cnk
|
os=-cnk
|
||||||
;;
|
;;
|
||||||
-sim | -cisco | -oki | -wec | -winbond)
|
-sim | -cisco | -oki | -wec | -winbond)
|
||||||
os=
|
os=
|
||||||
@@ -174,10 +170,10 @@ case $os in
|
|||||||
os=-chorusos
|
os=-chorusos
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-chorusrdb)
|
-chorusrdb)
|
||||||
os=-chorusrdb
|
os=-chorusrdb
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-hiux*)
|
-hiux*)
|
||||||
os=-hiuxwe2
|
os=-hiuxwe2
|
||||||
;;
|
;;
|
||||||
@@ -222,6 +218,12 @@ case $os in
|
|||||||
-isc*)
|
-isc*)
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
|
-lynx*178)
|
||||||
|
os=-lynxos178
|
||||||
|
;;
|
||||||
|
-lynx*5)
|
||||||
|
os=-lynxos5
|
||||||
|
;;
|
||||||
-lynx*)
|
-lynx*)
|
||||||
os=-lynxos
|
os=-lynxos
|
||||||
;;
|
;;
|
||||||
@@ -246,20 +248,28 @@ case $basic_machine in
|
|||||||
# Some are omitted here because they have special meanings below.
|
# Some are omitted here because they have special meanings below.
|
||||||
1750a | 580 \
|
1750a | 580 \
|
||||||
| a29k \
|
| a29k \
|
||||||
|
| aarch64 | aarch64_be \
|
||||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||||
| am33_2.0 \
|
| am33_2.0 \
|
||||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
| arc | arceb \
|
||||||
|
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||||
|
| avr | avr32 \
|
||||||
|
| be32 | be64 \
|
||||||
| bfin \
|
| bfin \
|
||||||
| c4x | clipper \
|
| c4x | c8051 | clipper \
|
||||||
| d10v | d30v | dlx | dsp16xx \
|
| d10v | d30v | dlx | dsp16xx \
|
||||||
| fido | fr30 | frv \
|
| epiphany \
|
||||||
|
| fido | fr30 | frv | ft32 \
|
||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
|
| hexagon \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
|
| k1om \
|
||||||
|
| le32 | le64 \
|
||||||
| lm32 \
|
| lm32 \
|
||||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||||
| maxq | mb | microblaze | mcore | mep | metag \
|
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
@@ -273,38 +283,55 @@ case $basic_machine in
|
|||||||
| mips64vr5900 | mips64vr5900el \
|
| mips64vr5900 | mips64vr5900el \
|
||||||
| mipsisa32 | mipsisa32el \
|
| mipsisa32 | mipsisa32el \
|
||||||
| mipsisa32r2 | mipsisa32r2el \
|
| mipsisa32r2 | mipsisa32r2el \
|
||||||
|
| mipsisa32r6 | mipsisa32r6el \
|
||||||
| mipsisa64 | mipsisa64el \
|
| mipsisa64 | mipsisa64el \
|
||||||
| mipsisa64r2 | mipsisa64r2el \
|
| mipsisa64r2 | mipsisa64r2el \
|
||||||
|
| mipsisa64r6 | mipsisa64r6el \
|
||||||
| mipsisa64sb1 | mipsisa64sb1el \
|
| mipsisa64sb1 | mipsisa64sb1el \
|
||||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||||
|
| mipsr5900 | mipsr5900el \
|
||||||
| mipstx39 | mipstx39el \
|
| mipstx39 | mipstx39el \
|
||||||
| mn10200 | mn10300 \
|
| mn10200 | mn10300 \
|
||||||
| moxie \
|
| moxie \
|
||||||
| mt \
|
| mt \
|
||||||
| msp430 \
|
| msp430 \
|
||||||
| nios | nios2 \
|
| nds32 | nds32le | nds32be \
|
||||||
|
| nios | nios2 | nios2eb | nios2el \
|
||||||
| ns16k | ns32k \
|
| ns16k | ns32k \
|
||||||
| or32 \
|
| open8 | or1k | or1knd | or32 \
|
||||||
| pdp10 | pdp11 | pj | pjl \
|
| pdp10 | pdp11 | pj | pjl \
|
||||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||||
| pyramid \
|
| pyramid \
|
||||||
| rx \
|
| riscv32 | riscv64 \
|
||||||
|
| rl78 | rx \
|
||||||
| score \
|
| score \
|
||||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||||
| spu | strongarm \
|
| spu \
|
||||||
| tahoe | thumb | tic4x | tic80 | tron \
|
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||||
| ubicom32 \
|
| ubicom32 \
|
||||||
| v850 | v850e \
|
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||||
|
| visium \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
| x86 | xc16x | xstormy16 | xtensa \
|
||||||
| z8k | z80)
|
| z8k | z80)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
c54x)
|
||||||
# Motorola 68HC11/12.
|
basic_machine=tic54x-unknown
|
||||||
|
;;
|
||||||
|
c55x)
|
||||||
|
basic_machine=tic55x-unknown
|
||||||
|
;;
|
||||||
|
c6x)
|
||||||
|
basic_machine=tic6x-unknown
|
||||||
|
;;
|
||||||
|
leon|leon[3-9])
|
||||||
|
basic_machine=sparc-$basic_machine
|
||||||
|
;;
|
||||||
|
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-none
|
os=-none
|
||||||
;;
|
;;
|
||||||
@@ -314,6 +341,21 @@ case $basic_machine in
|
|||||||
basic_machine=mt-unknown
|
basic_machine=mt-unknown
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
strongarm | thumb | xscale)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
;;
|
||||||
|
xgate)
|
||||||
|
basic_machine=$basic_machine-unknown
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
xscaleeb)
|
||||||
|
basic_machine=armeb-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
|
xscaleel)
|
||||||
|
basic_machine=armel-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
# We use `pc' rather than `unknown'
|
# We use `pc' rather than `unknown'
|
||||||
# because (1) that's what they normally are, and
|
# because (1) that's what they normally are, and
|
||||||
# (2) the word "unknown" tends to confuse beginning users.
|
# (2) the word "unknown" tends to confuse beginning users.
|
||||||
@@ -328,25 +370,31 @@ case $basic_machine in
|
|||||||
# Recognize the basic CPU types with company name.
|
# Recognize the basic CPU types with company name.
|
||||||
580-* \
|
580-* \
|
||||||
| a29k-* \
|
| a29k-* \
|
||||||
|
| aarch64-* | aarch64_be-* \
|
||||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||||
| avr-* | avr32-* \
|
| avr-* | avr32-* \
|
||||||
|
| be32-* | be64-* \
|
||||||
| bfin-* | bs2000-* \
|
| bfin-* | bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||||
| clipper-* | craynv-* | cydra-* \
|
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| elxsi-* \
|
||||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||||
| h8300-* | h8500-* \
|
| h8300-* | h8500-* \
|
||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
|
| hexagon-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia64-* \
|
||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
|
| k1om-* \
|
||||||
|
| le32-* | le64-* \
|
||||||
| lm32-* \
|
| lm32-* \
|
||||||
| m32c-* | m32r-* | m32rle-* \
|
| m32c-* | m32r-* | m32rle-* \
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||||
|
| microblaze-* | microblazeel-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
@@ -360,33 +408,42 @@ case $basic_machine in
|
|||||||
| mips64vr5900-* | mips64vr5900el-* \
|
| mips64vr5900-* | mips64vr5900el-* \
|
||||||
| mipsisa32-* | mipsisa32el-* \
|
| mipsisa32-* | mipsisa32el-* \
|
||||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||||
|
| mipsisa32r6-* | mipsisa32r6el-* \
|
||||||
| mipsisa64-* | mipsisa64el-* \
|
| mipsisa64-* | mipsisa64el-* \
|
||||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||||
|
| mipsisa64r6-* | mipsisa64r6el-* \
|
||||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||||
|
| mipsr5900-* | mipsr5900el-* \
|
||||||
| mipstx39-* | mipstx39el-* \
|
| mipstx39-* | mipstx39el-* \
|
||||||
| mmix-* \
|
| mmix-* \
|
||||||
| mt-* \
|
| mt-* \
|
||||||
| msp430-* \
|
| msp430-* \
|
||||||
| nios-* | nios2-* \
|
| nds32-* | nds32le-* | nds32be-* \
|
||||||
|
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||||
|
| open8-* \
|
||||||
|
| or1k*-* \
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||||
| pyramid-* \
|
| pyramid-* \
|
||||||
| romp-* | rs6000-* | rx-* \
|
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
|
| tile*-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| ubicom32-* \
|
| ubicom32-* \
|
||||||
| v850-* | v850e-* | vax-* \
|
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||||
|
| vax-* \
|
||||||
|
| visium-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||||
| xstormy16-* | xtensa*-* \
|
| xstormy16-* | xtensa*-* \
|
||||||
| ymp-* \
|
| ymp-* \
|
||||||
| z8k-* | z80-*)
|
| z8k-* | z80-*)
|
||||||
@@ -411,7 +468,7 @@ case $basic_machine in
|
|||||||
basic_machine=a29k-amd
|
basic_machine=a29k-amd
|
||||||
os=-udi
|
os=-udi
|
||||||
;;
|
;;
|
||||||
abacus)
|
abacus)
|
||||||
basic_machine=abacus-unknown
|
basic_machine=abacus-unknown
|
||||||
;;
|
;;
|
||||||
adobe68k)
|
adobe68k)
|
||||||
@@ -481,11 +538,20 @@ case $basic_machine in
|
|||||||
basic_machine=powerpc-ibm
|
basic_machine=powerpc-ibm
|
||||||
os=-cnk
|
os=-cnk
|
||||||
;;
|
;;
|
||||||
|
c54x-*)
|
||||||
|
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c55x-*)
|
||||||
|
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c6x-*)
|
||||||
|
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
cegcc)
|
cegcc)
|
||||||
basic_machine=arm-unknown
|
basic_machine=arm-unknown
|
||||||
os=-cegcc
|
os=-cegcc
|
||||||
;;
|
;;
|
||||||
@@ -517,7 +583,7 @@ case $basic_machine in
|
|||||||
basic_machine=craynv-cray
|
basic_machine=craynv-cray
|
||||||
os=-unicosmp
|
os=-unicosmp
|
||||||
;;
|
;;
|
||||||
cr16)
|
cr16 | cr16-*)
|
||||||
basic_machine=cr16-unknown
|
basic_machine=cr16-unknown
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
@@ -675,7 +741,6 @@ case $basic_machine in
|
|||||||
i370-ibm* | ibm*)
|
i370-ibm* | ibm*)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
;;
|
;;
|
||||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
|
||||||
i*86v32)
|
i*86v32)
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||||
os=-sysv32
|
os=-sysv32
|
||||||
@@ -714,6 +779,9 @@ case $basic_machine in
|
|||||||
basic_machine=m68k-isi
|
basic_machine=m68k-isi
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
leon-*|leon[3-9]-*)
|
||||||
|
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
||||||
|
;;
|
||||||
m68knommu)
|
m68knommu)
|
||||||
basic_machine=m68k-unknown
|
basic_machine=m68k-unknown
|
||||||
os=-linux
|
os=-linux
|
||||||
@@ -733,11 +801,15 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-utek
|
basic_machine=ns32k-utek
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
microblaze)
|
microblaze*)
|
||||||
basic_machine=microblaze-xilinx
|
basic_machine=microblaze-xilinx
|
||||||
;;
|
;;
|
||||||
|
mingw64)
|
||||||
|
basic_machine=x86_64-pc
|
||||||
|
os=-mingw64
|
||||||
|
;;
|
||||||
mingw32)
|
mingw32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i686-pc
|
||||||
os=-mingw32
|
os=-mingw32
|
||||||
;;
|
;;
|
||||||
mingw32ce)
|
mingw32ce)
|
||||||
@@ -765,6 +837,10 @@ case $basic_machine in
|
|||||||
basic_machine=powerpc-unknown
|
basic_machine=powerpc-unknown
|
||||||
os=-morphos
|
os=-morphos
|
||||||
;;
|
;;
|
||||||
|
moxiebox)
|
||||||
|
basic_machine=moxie-unknown
|
||||||
|
os=-moxiebox
|
||||||
|
;;
|
||||||
msdos)
|
msdos)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-msdos
|
os=-msdos
|
||||||
@@ -772,10 +848,18 @@ case $basic_machine in
|
|||||||
ms1-*)
|
ms1-*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||||
;;
|
;;
|
||||||
|
msys)
|
||||||
|
basic_machine=i686-pc
|
||||||
|
os=-msys
|
||||||
|
;;
|
||||||
mvs)
|
mvs)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
os=-mvs
|
os=-mvs
|
||||||
;;
|
;;
|
||||||
|
nacl)
|
||||||
|
basic_machine=le32-unknown
|
||||||
|
os=-nacl
|
||||||
|
;;
|
||||||
ncr3000)
|
ncr3000)
|
||||||
basic_machine=i486-ncr
|
basic_machine=i486-ncr
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
@@ -840,6 +924,12 @@ case $basic_machine in
|
|||||||
np1)
|
np1)
|
||||||
basic_machine=np1-gould
|
basic_machine=np1-gould
|
||||||
;;
|
;;
|
||||||
|
neo-tandem)
|
||||||
|
basic_machine=neo-tandem
|
||||||
|
;;
|
||||||
|
nse-tandem)
|
||||||
|
basic_machine=nse-tandem
|
||||||
|
;;
|
||||||
nsr-tandem)
|
nsr-tandem)
|
||||||
basic_machine=nsr-tandem
|
basic_machine=nsr-tandem
|
||||||
;;
|
;;
|
||||||
@@ -922,9 +1012,10 @@ case $basic_machine in
|
|||||||
;;
|
;;
|
||||||
power) basic_machine=power-ibm
|
power) basic_machine=power-ibm
|
||||||
;;
|
;;
|
||||||
ppc) basic_machine=powerpc-unknown
|
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||||
;;
|
;;
|
||||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
ppc-* | ppcbe-*)
|
||||||
|
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||||
basic_machine=powerpcle-unknown
|
basic_machine=powerpcle-unknown
|
||||||
@@ -949,7 +1040,11 @@ case $basic_machine in
|
|||||||
basic_machine=i586-unknown
|
basic_machine=i586-unknown
|
||||||
os=-pw32
|
os=-pw32
|
||||||
;;
|
;;
|
||||||
rdos)
|
rdos | rdos64)
|
||||||
|
basic_machine=x86_64-pc
|
||||||
|
os=-rdos
|
||||||
|
;;
|
||||||
|
rdos32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-rdos
|
os=-rdos
|
||||||
;;
|
;;
|
||||||
@@ -1018,6 +1113,9 @@ case $basic_machine in
|
|||||||
basic_machine=i860-stratus
|
basic_machine=i860-stratus
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
|
strongarm-* | thumb-*)
|
||||||
|
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
sun2)
|
sun2)
|
||||||
basic_machine=m68000-sun
|
basic_machine=m68000-sun
|
||||||
;;
|
;;
|
||||||
@@ -1074,20 +1172,8 @@ case $basic_machine in
|
|||||||
basic_machine=t90-cray
|
basic_machine=t90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
tic54x | c54x*)
|
|
||||||
basic_machine=tic54x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic55x | c55x*)
|
|
||||||
basic_machine=tic55x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic6x | c6x*)
|
|
||||||
basic_machine=tic6x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tile*)
|
tile*)
|
||||||
basic_machine=tile-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-linux-gnu
|
os=-linux-gnu
|
||||||
;;
|
;;
|
||||||
tx39)
|
tx39)
|
||||||
@@ -1157,6 +1243,9 @@ case $basic_machine in
|
|||||||
xps | xps100)
|
xps | xps100)
|
||||||
basic_machine=xps100-honeywell
|
basic_machine=xps100-honeywell
|
||||||
;;
|
;;
|
||||||
|
xscale-* | xscalee[bl]-*)
|
||||||
|
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||||
|
;;
|
||||||
ymp)
|
ymp)
|
||||||
basic_machine=ymp-cray
|
basic_machine=ymp-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
@@ -1254,11 +1343,11 @@ esac
|
|||||||
if [ x"$os" != x"" ]
|
if [ x"$os" != x"" ]
|
||||||
then
|
then
|
||||||
case $os in
|
case $os in
|
||||||
# First match some system type aliases
|
# First match some system type aliases
|
||||||
# that might get confused with valid system types.
|
# that might get confused with valid system types.
|
||||||
# -solaris* is a basic system type, with this one exception.
|
# -solaris* is a basic system type, with this one exception.
|
||||||
-auroraux)
|
-auroraux)
|
||||||
os=-auroraux
|
os=-auroraux
|
||||||
;;
|
;;
|
||||||
-solaris1 | -solaris1.*)
|
-solaris1 | -solaris1.*)
|
||||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||||
@@ -1282,28 +1371,29 @@ case $os in
|
|||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||||
| -sym* | -kopensolaris* \
|
| -sym* | -kopensolaris* | -plan9* \
|
||||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||||
| -aos* | -aros* \
|
| -aos* | -aros* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||||
| -openbsd* | -solidbsd* \
|
| -bitrig* | -openbsd* | -solidbsd* \
|
||||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||||
|
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
@@ -1342,7 +1432,7 @@ case $os in
|
|||||||
-opened*)
|
-opened*)
|
||||||
os=-openedition
|
os=-openedition
|
||||||
;;
|
;;
|
||||||
-os400*)
|
-os400*)
|
||||||
os=-os400
|
os=-os400
|
||||||
;;
|
;;
|
||||||
-wince*)
|
-wince*)
|
||||||
@@ -1391,7 +1481,7 @@ case $os in
|
|||||||
-sinix*)
|
-sinix*)
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
-tpf*)
|
-tpf*)
|
||||||
os=-tpf
|
os=-tpf
|
||||||
;;
|
;;
|
||||||
-triton*)
|
-triton*)
|
||||||
@@ -1427,17 +1517,14 @@ case $os in
|
|||||||
-aros*)
|
-aros*)
|
||||||
os=-aros
|
os=-aros
|
||||||
;;
|
;;
|
||||||
-kaos*)
|
|
||||||
os=-kaos
|
|
||||||
;;
|
|
||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
-dicos*)
|
-dicos*)
|
||||||
os=-dicos
|
os=-dicos
|
||||||
;;
|
;;
|
||||||
-nacl*)
|
-nacl*)
|
||||||
;;
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -1460,10 +1547,10 @@ else
|
|||||||
# system, and we'll never get to this point.
|
# system, and we'll never get to this point.
|
||||||
|
|
||||||
case $basic_machine in
|
case $basic_machine in
|
||||||
score-*)
|
score-*)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
spu-*)
|
spu-*)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
*-acorn)
|
*-acorn)
|
||||||
@@ -1475,8 +1562,23 @@ case $basic_machine in
|
|||||||
arm*-semi)
|
arm*-semi)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
c4x-* | tic4x-*)
|
c4x-* | tic4x-*)
|
||||||
os=-coff
|
os=-coff
|
||||||
|
;;
|
||||||
|
c8051-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
hexagon-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
tic54x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic55x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic6x-*)
|
||||||
|
os=-coff
|
||||||
;;
|
;;
|
||||||
# This must come before the *-dec entry.
|
# This must come before the *-dec entry.
|
||||||
pdp10-*)
|
pdp10-*)
|
||||||
@@ -1496,14 +1598,11 @@ case $basic_machine in
|
|||||||
;;
|
;;
|
||||||
m68000-sun)
|
m68000-sun)
|
||||||
os=-sunos3
|
os=-sunos3
|
||||||
# This also exists in the configure program, but was not the
|
|
||||||
# default.
|
|
||||||
# os=-sunos4
|
|
||||||
;;
|
;;
|
||||||
m68*-cisco)
|
m68*-cisco)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
mep-*)
|
mep-*)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
mips*-cisco)
|
mips*-cisco)
|
||||||
@@ -1530,7 +1629,7 @@ case $basic_machine in
|
|||||||
*-ibm)
|
*-ibm)
|
||||||
os=-aix
|
os=-aix
|
||||||
;;
|
;;
|
||||||
*-knuth)
|
*-knuth)
|
||||||
os=-mmixware
|
os=-mmixware
|
||||||
;;
|
;;
|
||||||
*-wec)
|
*-wec)
|
||||||
|
|||||||
244
libpcap/configure
vendored
244
libpcap/configure
vendored
@@ -631,6 +631,7 @@ CAN_SRC
|
|||||||
PCAP_SUPPORT_CAN
|
PCAP_SUPPORT_CAN
|
||||||
CANUSB_SRC
|
CANUSB_SRC
|
||||||
PCAP_SUPPORT_CANUSB
|
PCAP_SUPPORT_CANUSB
|
||||||
|
BT_MONITOR_SRC
|
||||||
BT_SRC
|
BT_SRC
|
||||||
PCAP_SUPPORT_BT
|
PCAP_SUPPORT_BT
|
||||||
NETFILTER_SRC
|
NETFILTER_SRC
|
||||||
@@ -741,6 +742,7 @@ with_snf_includes
|
|||||||
with_snf_libraries
|
with_snf_libraries
|
||||||
enable_universal
|
enable_universal
|
||||||
enable_shared
|
enable_shared
|
||||||
|
enable_usb
|
||||||
enable_bluetooth
|
enable_bluetooth
|
||||||
enable_canusb
|
enable_canusb
|
||||||
enable_can
|
enable_can
|
||||||
@@ -1376,6 +1378,8 @@ Optional Features:
|
|||||||
--enable-yydebug build parser debugging code
|
--enable-yydebug build parser debugging code
|
||||||
--disable-universal don't build universal on OS X
|
--disable-universal don't build universal on OS X
|
||||||
--enable-shared build shared libraries [default=no]
|
--enable-shared build shared libraries [default=no]
|
||||||
|
--enable-usb enable nusb support [default=yes, if support
|
||||||
|
available]
|
||||||
--enable-bluetooth enable Bluetooth support [default=no]
|
--enable-bluetooth enable Bluetooth support [default=no]
|
||||||
--enable-canusb enable canusb support [default=no]
|
--enable-canusb enable canusb support [default=no]
|
||||||
--enable-can enable CAN support [default=no]
|
--enable-can enable CAN support [default=no]
|
||||||
@@ -4694,6 +4698,28 @@ done
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$host_os" in
|
||||||
|
linux*)
|
||||||
|
for ac_header in linux/sockios.h linux/if_bonding.h
|
||||||
|
do :
|
||||||
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
|
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
|
||||||
|
"
|
||||||
|
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if test "$GCC" = yes ; then
|
if test "$GCC" = yes ; then
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI ioctl definitions" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI ioctl definitions" >&5
|
||||||
$as_echo_n "checking for ANSI ioctl definitions... " >&6; }
|
$as_echo_n "checking for ANSI ioctl definitions... " >&6; }
|
||||||
@@ -5502,6 +5528,13 @@ fi
|
|||||||
if test x$with_libnl = xyes ; then
|
if test x$with_libnl = xyes ; then
|
||||||
have_any_nl="no"
|
have_any_nl="no"
|
||||||
|
|
||||||
|
incdir=-I/usr/include/libnl3
|
||||||
|
libnldir=
|
||||||
|
if test x$withval != x ; then
|
||||||
|
libnldir=-L${withval}/lib/.libs
|
||||||
|
incdir=-I${withval}/include
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try libnl 3.x first.
|
# Try libnl 3.x first.
|
||||||
#
|
#
|
||||||
@@ -5511,7 +5544,7 @@ if ${ac_cv_lib_nl_3_nl_socket_alloc+:} false; then :
|
|||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
LIBS="-lnl-3 $LIBS"
|
LIBS="-lnl-3 ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
@@ -5546,7 +5579,7 @@ if test "x$ac_cv_lib_nl_3_nl_socket_alloc" = xyes; then :
|
|||||||
#
|
#
|
||||||
# Yes, we have libnl 3.x.
|
# Yes, we have libnl 3.x.
|
||||||
#
|
#
|
||||||
LIBS="-lnl-genl-3 -lnl-3 $LIBS"
|
LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
|
||||||
|
|
||||||
$as_echo "#define HAVE_LIBNL 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBNL 1" >>confdefs.h
|
||||||
|
|
||||||
@@ -5559,7 +5592,7 @@ $as_echo "#define HAVE_LIBNL_NLE 1" >>confdefs.h
|
|||||||
|
|
||||||
$as_echo "#define HAVE_LIBNL_SOCKETS 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBNL_SOCKETS 1" >>confdefs.h
|
||||||
|
|
||||||
V_INCLS="$V_INCLS -I/usr/include/libnl3"
|
V_INCLS="$V_INCLS ${incdir}"
|
||||||
have_any_nl="yes"
|
have_any_nl="yes"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -5610,7 +5643,7 @@ if test "x$ac_cv_lib_nl_nl_socket_alloc" = xyes; then :
|
|||||||
#
|
#
|
||||||
# Yes, we have libnl 2.x.
|
# Yes, we have libnl 2.x.
|
||||||
#
|
#
|
||||||
LIBS="-lnl-genl -lnl $LIBS"
|
LIBS="${libnldir} -lnl-genl -lnl $LIBS"
|
||||||
|
|
||||||
$as_echo "#define HAVE_LIBNL 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBNL 1" >>confdefs.h
|
||||||
|
|
||||||
@@ -5674,7 +5707,7 @@ if test "x$ac_cv_lib_nl_nl_handle_alloc" = xyes; then :
|
|||||||
#
|
#
|
||||||
# Yes.
|
# Yes.
|
||||||
#
|
#
|
||||||
LIBS="-lnl $LIBS"
|
LIBS="${libnldir} -lnl $LIBS"
|
||||||
|
|
||||||
$as_echo "#define HAVE_LIBNL 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBNL 1" >>confdefs.h
|
||||||
|
|
||||||
@@ -7625,10 +7658,19 @@ ln -s ${srcdir}/bpf/net net
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for USB sniffing support" >&5
|
# Check whether --enable-usb was given.
|
||||||
|
if test "${enable_usb+set}" = set; then :
|
||||||
|
enableval=$enable_usb;
|
||||||
|
else
|
||||||
|
enable_usb=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x$enable_usb" != "xno" ; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for USB sniffing support" >&5
|
||||||
$as_echo_n "checking for USB sniffing support... " >&6; }
|
$as_echo_n "checking for USB sniffing support... " >&6; }
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
linux*)
|
linux*)
|
||||||
|
|
||||||
$as_echo "#define PCAP_SUPPORT_USB 1" >>confdefs.h
|
$as_echo "#define PCAP_SUPPORT_USB 1" >>confdefs.h
|
||||||
|
|
||||||
@@ -7741,11 +7783,12 @@ $as_echo "#define HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE 1" >>confdefs.h
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
$as_echo "no" >&6; }
|
$as_echo "no" >&6; }
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -7872,23 +7915,75 @@ $as_echo "$ac_cv_lbl_sockaddr_hci_has_hci_channel" >&6; }
|
|||||||
|
|
||||||
$as_echo "#define SOCKADDR_HCI_HAS_HCI_CHANNEL /**/" >>confdefs.h
|
$as_echo "#define SOCKADDR_HCI_HAS_HCI_CHANNEL /**/" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# OK, is HCI_CHANNEL_MONITOR defined?
|
||||||
|
#
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if HCI_CHANNEL_MONITOR is defined" >&5
|
||||||
|
$as_echo_n "checking if HCI_CHANNEL_MONITOR is defined... " >&6; }
|
||||||
|
if ${ac_cv_lbl_hci_channel_monitor_is_defined+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
|
#include <bluetooth/hci.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
u_int i = HCI_CHANNEL_MONITOR
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
ac_cv_lbl_hci_channel_monitor_is_defined=yes
|
||||||
|
else
|
||||||
|
ac_cv_lbl_hci_channel_monitor_is_defined=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_hci_channel_monitor_is_defined" >&5
|
||||||
|
$as_echo "$ac_cv_lbl_hci_channel_monitor_is_defined" >&6; }
|
||||||
|
if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
|
||||||
|
|
||||||
|
$as_echo "#define PCAP_SUPPORT_BT_MONITOR /**/" >>confdefs.h
|
||||||
|
|
||||||
|
BT_MONITOR_SRC=pcap-bt-monitor-linux.c
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
ac_lbl_bluetooth_available=yes
|
||||||
|
|
||||||
else
|
else
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
|
ac_lbl_bluetooth_available=no
|
||||||
$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x$ac_lbl_bluetooth_available" == "xno" ; then
|
||||||
|
if test "x$enable_bluetooth" = "xyes" ; then
|
||||||
|
as_fn_error $? "Bluetooth sniffing is not supported; install bluez-lib devel to enable it" "$LINENO" 5
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
|
||||||
|
$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
|
if test "x$enable_bluetooth" = "xyes" ; then
|
||||||
|
as_fn_error $? "no Bluetooth sniffing support implemented for $host_os" "$LINENO" 5
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
|
||||||
$as_echo "$as_me: no Bluetooth sniffing support implemented for $host_os" >&6;}
|
$as_echo "$as_me: no Bluetooth sniffing support implemented for $host_os" >&6;}
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check whether --enable-canusb was given.
|
# Check whether --enable-canusb was given.
|
||||||
@@ -7901,29 +7996,86 @@ fi
|
|||||||
|
|
||||||
if test "x$enable_canusb" != "xno" ; then
|
if test "x$enable_canusb" != "xno" ; then
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
linux*)
|
linux*|uclinux*)
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "libusb-1.0/libusb.h" "ac_cv_header_libusb_1_0_libusb_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "libusb-1.0/libusb.h" "ac_cv_header_libusb_1_0_libusb_h" "$ac_includes_default"
|
||||||
if test "x$ac_cv_header_libusb_1_0_libusb_h" = xyes; then :
|
if test "x$ac_cv_header_libusb_1_0_libusb_h" = xyes; then :
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb_init in -lusb-1.0" >&5
|
||||||
|
$as_echo_n "checking for libusb_init in -lusb-1.0... " >&6; }
|
||||||
|
if ${ac_cv_lib_usb_1_0_libusb_init+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-lusb-1.0 -lpthread
|
||||||
|
$LIBS"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* 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 libusb_init ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return libusb_init ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_lib_usb_1_0_libusb_init=yes
|
||||||
|
else
|
||||||
|
ac_cv_lib_usb_1_0_libusb_init=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_1_0_libusb_init" >&5
|
||||||
|
$as_echo "$ac_cv_lib_usb_1_0_libusb_init" >&6; }
|
||||||
|
if test "x$ac_cv_lib_usb_1_0_libusb_init" = xyes; then :
|
||||||
|
|
||||||
|
|
||||||
$as_echo "#define PCAP_SUPPORT_CANUSB 1" >>confdefs.h
|
$as_echo "#define PCAP_SUPPORT_CANUSB 1" >>confdefs.h
|
||||||
|
|
||||||
CANUSB_SRC=pcap-canusb-linux.c
|
CANUSB_SRC=pcap-canusb-linux.c
|
||||||
LIBS="-lusb-1.0 -lpthread $LIBS"
|
LIBS="-lusb-1.0 -lpthread $LIBS"
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
|
ac_lbl_has_libusb=yes
|
||||||
$as_echo "$as_me: canusb sniffing is supported" >&6;}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
|
ac_lbl_has_libusb=no
|
||||||
$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
ac_lbl_has_libusb=no
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x$ac_lbl_has_libusb" = "xyes" ; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
|
||||||
|
$as_echo "$as_me: canusb sniffing is supported" >&6;}
|
||||||
|
else
|
||||||
|
if test "x$enable_canusb" = "xyes" ; then
|
||||||
|
as_fn_error $? "canusb sniffing is not supported; install libusb1.0 lib devel to enable it" "$LINENO" 5
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
|
||||||
|
$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
|
if test "x$enable_canusb" = "xyes" ; then
|
||||||
|
as_fn_error $? "no canusb support implemented for $host_os" "$LINENO" 5
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
|
||||||
$as_echo "$as_me: no canusb support implemented for $host_os" >&6;}
|
$as_echo "$as_me: no canusb support implemented for $host_os" >&6;}
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -7946,21 +8098,33 @@ if test "x$enable_can" != "xno" ; then
|
|||||||
"
|
"
|
||||||
if test "x$ac_cv_header_linux_can_h" = xyes; then :
|
if test "x$ac_cv_header_linux_can_h" = xyes; then :
|
||||||
|
|
||||||
|
|
||||||
$as_echo "#define PCAP_SUPPORT_CAN 1" >>confdefs.h
|
$as_echo "#define PCAP_SUPPORT_CAN 1" >>confdefs.h
|
||||||
|
|
||||||
CAN_SRC=pcap-can-linux.c
|
CAN_SRC=pcap-can-linux.c
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
|
||||||
$as_echo "$as_me: CAN sniffing is supported" >&6;}
|
$as_echo "$as_me: CAN sniffing is supported" >&6;}
|
||||||
|
|
||||||
else
|
else
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
|
|
||||||
|
if test "x$enable_can" = "xyes" ; then
|
||||||
|
as_fn_error $? "CAN sniffing is not supported" "$LINENO" 5
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
|
||||||
$as_echo "$as_me: CAN sniffing is not supported" >&6;}
|
$as_echo "$as_me: CAN sniffing is not supported" >&6;}
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
|
if test "x$enable_can" = "xyes" ; then
|
||||||
|
as_fn_error $? "no CAN sniffing support implemented for $host_os" "$LINENO" 5
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
|
||||||
$as_echo "$as_me: no CAN sniffing support implemented for $host_os" >&6;}
|
$as_echo "$as_me: no CAN sniffing support implemented for $host_os" >&6;}
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -7975,6 +8139,38 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x$enable_dbus" != "xno"; then
|
||||||
|
if test "x$enable_dbus" = "xyes"; then
|
||||||
|
case "$host_os" in
|
||||||
|
|
||||||
|
darwin*)
|
||||||
|
#
|
||||||
|
# We don't support D-Bus sniffing on OS X; see
|
||||||
|
#
|
||||||
|
# https://bugs.freedesktop.org/show_bug.cgi?id=74029
|
||||||
|
#
|
||||||
|
# The user requested it, so fail.
|
||||||
|
#
|
||||||
|
as_fn_error $? "Due to freedesktop.org bug 74029, D-Bus capture support is not available on OS X" "$LINENO" 5
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case "$host_os" in
|
||||||
|
|
||||||
|
darwin*)
|
||||||
|
#
|
||||||
|
# We don't support D-Bus sniffing on OS X; see
|
||||||
|
#
|
||||||
|
# https://bugs.freedesktop.org/show_bug.cgi?id=74029
|
||||||
|
#
|
||||||
|
# The user dind't explicitly request it, so just
|
||||||
|
# silently refuse to enable it.
|
||||||
|
#
|
||||||
|
enable_dbus="no"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$enable_dbus" != "xno"; then
|
if test "x$enable_dbus" != "xno"; then
|
||||||
# Extract the first word of "pkg-config", so it can be a program name with args.
|
# Extract the first word of "pkg-config", so it can be a program name with args.
|
||||||
set dummy pkg-config; ac_word=$2
|
set dummy pkg-config; ac_word=$2
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.168 2008-12-23 20:49:26 guy Exp $ (LBL)
|
|
||||||
dnl
|
dnl
|
||||||
dnl Copyright (c) 1994, 1995, 1996, 1997
|
dnl Copyright (c) 1994, 1995, 1996, 1997
|
||||||
dnl The Regents of the University of California. All rights reserved.
|
dnl The Regents of the University of California. All rights reserved.
|
||||||
@@ -149,6 +148,16 @@ struct rtentry;
|
|||||||
#include <net/if.h>])
|
#include <net/if.h>])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$host_os" in
|
||||||
|
linux*)
|
||||||
|
AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
|
||||||
|
[
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
AC_LBL_FIXINCLUDES
|
AC_LBL_FIXINCLUDES
|
||||||
|
|
||||||
AC_CHECK_FUNCS(strerror strlcpy)
|
AC_CHECK_FUNCS(strerror strlcpy)
|
||||||
@@ -361,11 +370,11 @@ dlpi)
|
|||||||
#
|
#
|
||||||
# Checks to see if Solaris has the public libdlpi(3LIB) library.
|
# Checks to see if Solaris has the public libdlpi(3LIB) library.
|
||||||
# Note: The existence of /usr/include/libdlpi.h does not mean it is the
|
# Note: The existence of /usr/include/libdlpi.h does not mean it is the
|
||||||
# public libdlpi(3LIB) version. Before libdlpi was made public, a
|
# public libdlpi(3LIB) version. Before libdlpi was made public, a
|
||||||
# private version also existed, which did not have the same APIs.
|
# private version also existed, which did not have the same APIs.
|
||||||
# Due to a gcc bug, the default search path for 32-bit libraries does
|
# Due to a gcc bug, the default search path for 32-bit libraries does
|
||||||
# not include /lib, we add it explicitly here.
|
# not include /lib, we add it explicitly here.
|
||||||
# [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
|
# [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
|
||||||
# Also, due to the bug above applications that link to libpcap with
|
# Also, due to the bug above applications that link to libpcap with
|
||||||
# libdlpi will have to add "-L/lib" option to "configure".
|
# libdlpi will have to add "-L/lib" option to "configure".
|
||||||
#
|
#
|
||||||
@@ -447,6 +456,13 @@ linux)
|
|||||||
if test x$with_libnl = xyes ; then
|
if test x$with_libnl = xyes ; then
|
||||||
have_any_nl="no"
|
have_any_nl="no"
|
||||||
|
|
||||||
|
incdir=-I/usr/include/libnl3
|
||||||
|
libnldir=
|
||||||
|
if test x$withval != x ; then
|
||||||
|
libnldir=-L${withval}/lib/.libs
|
||||||
|
incdir=-I${withval}/include
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try libnl 3.x first.
|
# Try libnl 3.x first.
|
||||||
#
|
#
|
||||||
@@ -455,14 +471,14 @@ linux)
|
|||||||
#
|
#
|
||||||
# Yes, we have libnl 3.x.
|
# Yes, we have libnl 3.x.
|
||||||
#
|
#
|
||||||
LIBS="-lnl-genl-3 -lnl-3 $LIBS"
|
LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
|
||||||
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
|
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
|
||||||
AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
|
AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
|
||||||
AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
|
AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
|
||||||
AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
|
AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
|
||||||
V_INCLS="$V_INCLS -I/usr/include/libnl3"
|
V_INCLS="$V_INCLS ${incdir}"
|
||||||
have_any_nl="yes"
|
have_any_nl="yes"
|
||||||
])
|
],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
|
||||||
|
|
||||||
if test x$have_any_nl = xno ; then
|
if test x$have_any_nl = xno ; then
|
||||||
#
|
#
|
||||||
@@ -473,7 +489,7 @@ linux)
|
|||||||
#
|
#
|
||||||
# Yes, we have libnl 2.x.
|
# Yes, we have libnl 2.x.
|
||||||
#
|
#
|
||||||
LIBS="-lnl-genl -lnl $LIBS"
|
LIBS="${libnldir} -lnl-genl -lnl $LIBS"
|
||||||
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
|
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
|
||||||
AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
|
AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
|
||||||
AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
|
AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
|
||||||
@@ -491,7 +507,7 @@ linux)
|
|||||||
#
|
#
|
||||||
# Yes.
|
# Yes.
|
||||||
#
|
#
|
||||||
LIBS="-lnl $LIBS"
|
LIBS="${libnldir} -lnl $LIBS"
|
||||||
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
|
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
|
||||||
have_any_nl="yes"
|
have_any_nl="yes"
|
||||||
])
|
])
|
||||||
@@ -529,7 +545,7 @@ bpf)
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/bpf.h>],
|
#include <net/bpf.h>],
|
||||||
[return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
|
[return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
|
||||||
[
|
[
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
|
AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
|
||||||
[define if the system supports zerocopy BPF])
|
[define if the system supports zerocopy BPF])
|
||||||
@@ -777,7 +793,7 @@ if test "$want_dag" != no; then
|
|||||||
if test -z "$dag_lib_dir"; then
|
if test -z "$dag_lib_dir"; then
|
||||||
dag_lib_dir="$dag_root/lib"
|
dag_lib_dir="$dag_root/lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dag_tools_dir"; then
|
if test -z "$dag_tools_dir"; then
|
||||||
dag_tools_dir="$dag_root/tools"
|
dag_tools_dir="$dag_root/tools"
|
||||||
fi
|
fi
|
||||||
@@ -812,7 +828,7 @@ if test $ac_cv_lbl_dag_api = yes; then
|
|||||||
AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
|
AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
|
||||||
LIBS="$LIBS -ldag"
|
LIBS="$LIBS -ldag"
|
||||||
LDFLAGS="$LDFLAGS -L$dag_lib_dir"
|
LDFLAGS="$LDFLAGS -L$dag_lib_dir"
|
||||||
|
|
||||||
AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
|
AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
|
||||||
if test "$ac_dag_have_vdag" = 1; then
|
if test "$ac_dag_have_vdag" = 1; then
|
||||||
AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
|
AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
|
||||||
@@ -1329,10 +1345,16 @@ AC_SUBST(DYEXT)
|
|||||||
AC_SUBST(MAN_FILE_FORMATS)
|
AC_SUBST(MAN_FILE_FORMATS)
|
||||||
AC_SUBST(MAN_MISC_INFO)
|
AC_SUBST(MAN_MISC_INFO)
|
||||||
|
|
||||||
dnl check for USB sniffing support
|
AC_ARG_ENABLE([usb],
|
||||||
AC_MSG_CHECKING(for USB sniffing support)
|
[AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])],
|
||||||
case "$host_os" in
|
[],
|
||||||
linux*)
|
[enable_usb=yes])
|
||||||
|
|
||||||
|
if test "x$enable_usb" != "xno" ; then
|
||||||
|
dnl check for USB sniffing support
|
||||||
|
AC_MSG_CHECKING(for USB sniffing support)
|
||||||
|
case "$host_os" in
|
||||||
|
linux*)
|
||||||
AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
|
AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
|
||||||
USB_SRC=pcap-usb-linux.c
|
USB_SRC=pcap-usb-linux.c
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
@@ -1383,10 +1405,11 @@ AC_INCLUDES_DEFAULT
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
AC_SUBST(PCAP_SUPPORT_USB)
|
AC_SUBST(PCAP_SUPPORT_USB)
|
||||||
AC_SUBST(USB_SRC)
|
AC_SUBST(USB_SRC)
|
||||||
|
|
||||||
@@ -1466,17 +1489,50 @@ if test "x$enable_bluetooth" != "xno" ; then
|
|||||||
if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
|
if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
|
||||||
AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
|
AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
|
||||||
[if struct sockaddr_hci has hci_channel member])
|
[if struct sockaddr_hci has hci_channel member])
|
||||||
|
|
||||||
|
#
|
||||||
|
# OK, is HCI_CHANNEL_MONITOR defined?
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
|
||||||
|
AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
|
#include <bluetooth/hci.h>
|
||||||
|
],
|
||||||
|
[u_int i = HCI_CHANNEL_MONITOR],
|
||||||
|
ac_cv_lbl_hci_channel_monitor_is_defined=yes,
|
||||||
|
ac_cv_lbl_hci_channel_monitor_is_defined=no))
|
||||||
|
AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined)
|
||||||
|
if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
|
||||||
|
AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
|
||||||
|
[target host supports Bluetooth Monitor])
|
||||||
|
BT_MONITOR_SRC=pcap-bt-monitor-linux.c
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
ac_lbl_bluetooth_available=yes
|
||||||
],
|
],
|
||||||
AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
|
ac_lbl_bluetooth_available=no
|
||||||
)
|
)
|
||||||
|
if test "x$ac_lbl_bluetooth_available" == "xno" ; then
|
||||||
|
if test "x$enable_bluetooth" = "xyes" ; then
|
||||||
|
AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
|
if test "x$enable_bluetooth" = "xyes" ; then
|
||||||
|
AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
AC_SUBST(PCAP_SUPPORT_BT)
|
AC_SUBST(PCAP_SUPPORT_BT)
|
||||||
AC_SUBST(BT_SRC)
|
AC_SUBST(BT_SRC)
|
||||||
|
AC_SUBST(BT_MONITOR_SRC)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([canusb],
|
AC_ARG_ENABLE([canusb],
|
||||||
@@ -1487,19 +1543,38 @@ AC_ARG_ENABLE([canusb],
|
|||||||
if test "x$enable_canusb" != "xno" ; then
|
if test "x$enable_canusb" != "xno" ; then
|
||||||
dnl check for canusb support
|
dnl check for canusb support
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
linux*)
|
linux*|uclinux*)
|
||||||
AC_CHECK_HEADER(libusb-1.0/libusb.h,
|
AC_CHECK_HEADER(libusb-1.0/libusb.h,
|
||||||
[
|
[
|
||||||
AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
|
AC_CHECK_LIB(usb-1.0, libusb_init,
|
||||||
CANUSB_SRC=pcap-canusb-linux.c
|
[
|
||||||
LIBS="-lusb-1.0 -lpthread $LIBS"
|
AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
|
||||||
AC_MSG_NOTICE(canusb sniffing is supported)
|
CANUSB_SRC=pcap-canusb-linux.c
|
||||||
|
LIBS="-lusb-1.0 -lpthread $LIBS"
|
||||||
|
ac_lbl_has_libusb=yes
|
||||||
|
],
|
||||||
|
ac_lbl_has_libusb=no,
|
||||||
|
-lpthread
|
||||||
|
)
|
||||||
],
|
],
|
||||||
AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
|
ac_lbl_has_libusb=no
|
||||||
)
|
)
|
||||||
|
if test "x$ac_lbl_has_libusb" = "xyes" ; then
|
||||||
|
AC_MSG_NOTICE(canusb sniffing is supported)
|
||||||
|
else
|
||||||
|
if test "x$enable_canusb" = "xyes" ; then
|
||||||
|
AC_MSG_ERROR(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_NOTICE(no canusb support implemented for $host_os)
|
if test "x$enable_canusb" = "xyes" ; then
|
||||||
|
AC_MSG_ERROR(no canusb support implemented for $host_os)
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE(no canusb support implemented for $host_os)
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
AC_SUBST(PCAP_SUPPORT_CANUSB)
|
AC_SUBST(PCAP_SUPPORT_CANUSB)
|
||||||
@@ -1516,15 +1591,27 @@ if test "x$enable_can" != "xno" ; then
|
|||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
linux*)
|
linux*)
|
||||||
AC_CHECK_HEADER(linux/can.h,
|
AC_CHECK_HEADER(linux/can.h,
|
||||||
[ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
|
[
|
||||||
CAN_SRC=pcap-can-linux.c
|
AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
|
||||||
AC_MSG_NOTICE(CAN sniffing is supported)],
|
CAN_SRC=pcap-can-linux.c
|
||||||
AC_MSG_NOTICE(CAN sniffing is not supported),
|
AC_MSG_NOTICE(CAN sniffing is supported)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
if test "x$enable_can" = "xyes" ; then
|
||||||
|
AC_MSG_ERROR(CAN sniffing is not supported)
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE(CAN sniffing is not supported)
|
||||||
|
fi
|
||||||
|
],
|
||||||
[#include <sys/socket.h>]
|
[#include <sys/socket.h>]
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
|
if test "x$enable_can" = "xyes" ; then
|
||||||
|
AC_MSG_ERROR(no CAN sniffing support implemented for $host_os)
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
AC_SUBST(PCAP_SUPPORT_CAN)
|
AC_SUBST(PCAP_SUPPORT_CAN)
|
||||||
@@ -1536,6 +1623,38 @@ AC_ARG_ENABLE([dbus],
|
|||||||
[],
|
[],
|
||||||
[enable_dbus=no])
|
[enable_dbus=no])
|
||||||
|
|
||||||
|
if test "x$enable_dbus" != "xno"; then
|
||||||
|
if test "x$enable_dbus" = "xyes"; then
|
||||||
|
case "$host_os" in
|
||||||
|
|
||||||
|
darwin*)
|
||||||
|
#
|
||||||
|
# We don't support D-Bus sniffing on OS X; see
|
||||||
|
#
|
||||||
|
# https://bugs.freedesktop.org/show_bug.cgi?id=74029
|
||||||
|
#
|
||||||
|
# The user requested it, so fail.
|
||||||
|
#
|
||||||
|
AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on OS X])
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case "$host_os" in
|
||||||
|
|
||||||
|
darwin*)
|
||||||
|
#
|
||||||
|
# We don't support D-Bus sniffing on OS X; see
|
||||||
|
#
|
||||||
|
# https://bugs.freedesktop.org/show_bug.cgi?id=74029
|
||||||
|
#
|
||||||
|
# The user dind't explicitly request it, so just
|
||||||
|
# silently refuse to enable it.
|
||||||
|
#
|
||||||
|
enable_dbus="no"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$enable_dbus" != "xno"; then
|
if test "x$enable_dbus" != "xno"; then
|
||||||
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
|
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
|
||||||
if test "x$PKGCONFIG" != "xno"; then
|
if test "x$PKGCONFIG" != "xno"; then
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
* This file contains dlpi/libdlpi related common functions used
|
* This file contains dlpi/libdlpi related common functions used
|
||||||
* by pcap-[dlpi,libdlpi].c.
|
* by pcap-[dlpi,libdlpi].c.
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/dlpisubs.c,v 1.3 2008-12-02 16:40:19 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
/*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/dlpisubs.h,v 1.2 2008-04-04 19:37:45 guy Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef dlpisubs_h
|
#ifndef dlpisubs_h
|
||||||
#define dlpisubs_h
|
#define dlpisubs_h
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/etherent.c,v 1.23 2006-10-04 18:09:22 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/ethertype.h,v 1.14 2005-09-05 09:06:58 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -32,11 +32,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/fad-getad.c,v 1.12 2007-09-14 00:44:55 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -146,7 +141,7 @@ get_sa_len(struct sockaddr *addr)
|
|||||||
* Get a list of all interfaces that are up and that we can open.
|
* Get a list of all interfaces that are up and that we can open.
|
||||||
* Returns -1 on error, 0 otherwise.
|
* Returns -1 on error, 0 otherwise.
|
||||||
* The list, as returned through "alldevsp", may be null if no interfaces
|
* The list, as returned through "alldevsp", may be null if no interfaces
|
||||||
* were up and could be opened.
|
* could be opened.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
||||||
@@ -162,10 +157,10 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
* Get the list of interface addresses.
|
* Get the list of interface addresses.
|
||||||
*
|
*
|
||||||
* Note: this won't return information about interfaces
|
* Note: this won't return information about interfaces
|
||||||
* with no addresses; are there any such interfaces
|
* with no addresses, so, if a platform has interfaces
|
||||||
* that would be capable of receiving packets?
|
* with no interfaces on which traffic can be captured,
|
||||||
* (Interfaces incapable of receiving packets aren't
|
* we must check for those interfaces as well (see, for
|
||||||
* very interesting from libpcap's point of view.)
|
* example, what's done on Linux).
|
||||||
*
|
*
|
||||||
* LAN interfaces will probably have link-layer
|
* LAN interfaces will probably have link-layer
|
||||||
* addresses; I don't know whether all implementations
|
* addresses; I don't know whether all implementations
|
||||||
@@ -178,35 +173,12 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
|
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
|
||||||
/*
|
|
||||||
* Is this interface up?
|
|
||||||
*/
|
|
||||||
if (!(ifa->ifa_flags & IFF_UP)) {
|
|
||||||
/*
|
|
||||||
* No, so don't add it to the list.
|
|
||||||
*/
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "ifa_addr" was apparently null on at least one
|
* "ifa_addr" was apparently null on at least one
|
||||||
* interface on some system.
|
* interface on some system. Therefore, we supply
|
||||||
*
|
* the address and netmask only if "ifa_addr" is
|
||||||
* "ifa_broadaddr" may be non-null even on
|
* non-null (if there's no address, there's obviously
|
||||||
* non-broadcast interfaces, and was null on
|
* no netmask).
|
||||||
* at least one OpenBSD 3.4 system on at least
|
|
||||||
* one interface with IFF_BROADCAST set.
|
|
||||||
*
|
|
||||||
* "ifa_dstaddr" was, on at least one FreeBSD 4.1
|
|
||||||
* system, non-null on a non-point-to-point
|
|
||||||
* interface.
|
|
||||||
*
|
|
||||||
* Therefore, we supply the address and netmask only
|
|
||||||
* if "ifa_addr" is non-null (if there's no address,
|
|
||||||
* there's obviously no netmask), and supply the
|
|
||||||
* broadcast and destination addresses if the appropriate
|
|
||||||
* flag is set *and* the appropriate "ifa_" entry doesn't
|
|
||||||
* evaluate to a null pointer.
|
|
||||||
*/
|
*/
|
||||||
if (ifa->ifa_addr != NULL) {
|
if (ifa->ifa_addr != NULL) {
|
||||||
addr = ifa->ifa_addr;
|
addr = ifa->ifa_addr;
|
||||||
@@ -217,6 +189,22 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
addr_size = 0;
|
addr_size = 0;
|
||||||
netmask = NULL;
|
netmask = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that, on some platforms, ifa_broadaddr and
|
||||||
|
* ifa_dstaddr could be the same field (true on at
|
||||||
|
* least some versions of *BSD and OS X), so we
|
||||||
|
* can't just check whether the broadcast address
|
||||||
|
* is null and add it if so and check whether the
|
||||||
|
* destination address is null and add it if so.
|
||||||
|
*
|
||||||
|
* Therefore, we must also check the IFF_BROADCAST
|
||||||
|
* flag, and only add a broadcast address if it's
|
||||||
|
* set, and check the IFF_POINTTOPOINT flag, and
|
||||||
|
* only add a destination address if it's set (as
|
||||||
|
* per man page recommendations on some of those
|
||||||
|
* platforms).
|
||||||
|
*/
|
||||||
if (ifa->ifa_flags & IFF_BROADCAST &&
|
if (ifa->ifa_flags & IFF_BROADCAST &&
|
||||||
ifa->ifa_broadaddr != NULL) {
|
ifa->ifa_broadaddr != NULL) {
|
||||||
broadaddr = ifa->ifa_broadaddr;
|
broadaddr = ifa->ifa_broadaddr;
|
||||||
|
|||||||
@@ -32,11 +32,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/fad-gifc.c,v 1.12 2008-08-06 07:34:09 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -222,12 +217,12 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
/*
|
/*
|
||||||
* XXX - The 32-bit compatibility layer for Linux on IA-64
|
* XXX - The 32-bit compatibility layer for Linux on IA-64
|
||||||
* is slightly broken. It correctly converts the structures
|
* is slightly broken. It correctly converts the structures
|
||||||
* to and from kernel land from 64 bit to 32 bit but
|
* to and from kernel land from 64 bit to 32 bit but
|
||||||
* doesn't update ifc.ifc_len, leaving it larger than the
|
* doesn't update ifc.ifc_len, leaving it larger than the
|
||||||
* amount really used. This means we read off the end
|
* amount really used. This means we read off the end
|
||||||
* of the buffer and encounter an interface with an
|
* of the buffer and encounter an interface with an
|
||||||
* "empty" name. Since this is highly unlikely to ever
|
* "empty" name. Since this is highly unlikely to ever
|
||||||
* occur in a valid case we can just finish looking for
|
* occur in a valid case we can just finish looking for
|
||||||
* interfaces if we see an empty name.
|
* interfaces if we see an empty name.
|
||||||
*/
|
*/
|
||||||
if (!(*ifrp->ifr_name))
|
if (!(*ifrp->ifr_name))
|
||||||
@@ -242,8 +237,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the flags for this interface, and skip it if it's
|
* Get the flags for this interface.
|
||||||
* not up.
|
|
||||||
*/
|
*/
|
||||||
strncpy(ifrflags.ifr_name, ifrp->ifr_name,
|
strncpy(ifrflags.ifr_name, ifrp->ifr_name,
|
||||||
sizeof(ifrflags.ifr_name));
|
sizeof(ifrflags.ifr_name));
|
||||||
@@ -258,8 +252,6 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!(ifrflags.ifr_flags & IFF_UP))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the netmask for this address on this interface.
|
* Get the netmask for this address on this interface.
|
||||||
|
|||||||
@@ -32,11 +32,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/fad-glifc.c,v 1.7 2008-01-30 09:35:48 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -208,8 +203,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the flags for this interface, and skip it if it's
|
* Get the flags for this interface.
|
||||||
* not up.
|
|
||||||
*/
|
*/
|
||||||
strncpy(ifrflags.lifr_name, ifrp->lifr_name,
|
strncpy(ifrflags.lifr_name, ifrp->lifr_name,
|
||||||
sizeof(ifrflags.lifr_name));
|
sizeof(ifrflags.lifr_name));
|
||||||
@@ -224,8 +218,6 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!(ifrflags.lifr_flags & IFF_UP))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the netmask for this address on this interface.
|
* Get the netmask for this address on this interface.
|
||||||
|
|||||||
@@ -32,11 +32,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/fad-null.c,v 1.2 2003-11-15 23:23:58 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,8 +24,6 @@
|
|||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: fad-sita.c */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
|
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
|
||||||
* nor the names of its contributors may be used to endorse or promote
|
* nor the names of its contributors may be used to endorse or promote
|
||||||
* products derived from this software without specific prior written
|
* products derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
@@ -31,11 +31,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/fad-win32.c,v 1.15 2007-09-25 20:34:36 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -45,102 +40,6 @@ static const char rcsid[] _U_ =
|
|||||||
#include <Packet32.h>
|
#include <Packet32.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Add an entry to the list of addresses for an interface.
|
|
||||||
* "curdev" is the entry for that interface.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
add_addr_to_list(pcap_if_t *curdev, struct sockaddr *addr,
|
|
||||||
struct sockaddr *netmask, struct sockaddr *broadaddr,
|
|
||||||
struct sockaddr *dstaddr, char *errbuf)
|
|
||||||
{
|
|
||||||
pcap_addr_t *curaddr, *prevaddr, *nextaddr;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate the new entry and fill it in.
|
|
||||||
*/
|
|
||||||
curaddr = (pcap_addr_t*)malloc(sizeof(pcap_addr_t));
|
|
||||||
if (curaddr == NULL) {
|
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"malloc: %s", pcap_strerror(errno));
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
curaddr->next = NULL;
|
|
||||||
if (addr != NULL) {
|
|
||||||
curaddr->addr = (struct sockaddr*)dup_sockaddr(addr, sizeof(struct sockaddr_storage));
|
|
||||||
if (curaddr->addr == NULL) {
|
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"malloc: %s", pcap_strerror(errno));
|
|
||||||
free(curaddr);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
curaddr->addr = NULL;
|
|
||||||
|
|
||||||
if (netmask != NULL) {
|
|
||||||
curaddr->netmask = (struct sockaddr*)dup_sockaddr(netmask, sizeof(struct sockaddr_storage));
|
|
||||||
if (curaddr->netmask == NULL) {
|
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"malloc: %s", pcap_strerror(errno));
|
|
||||||
free(curaddr);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
curaddr->netmask = NULL;
|
|
||||||
|
|
||||||
if (broadaddr != NULL) {
|
|
||||||
curaddr->broadaddr = (struct sockaddr*)dup_sockaddr(broadaddr, sizeof(struct sockaddr_storage));
|
|
||||||
if (curaddr->broadaddr == NULL) {
|
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"malloc: %s", pcap_strerror(errno));
|
|
||||||
free(curaddr);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
curaddr->broadaddr = NULL;
|
|
||||||
|
|
||||||
if (dstaddr != NULL) {
|
|
||||||
curaddr->dstaddr = (struct sockaddr*)dup_sockaddr(dstaddr, sizeof(struct sockaddr_storage));
|
|
||||||
if (curaddr->dstaddr == NULL) {
|
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
|
||||||
"malloc: %s", pcap_strerror(errno));
|
|
||||||
free(curaddr);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
curaddr->dstaddr = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find the end of the list of addresses.
|
|
||||||
*/
|
|
||||||
for (prevaddr = curdev->addresses; prevaddr != NULL; prevaddr = nextaddr) {
|
|
||||||
nextaddr = prevaddr->next;
|
|
||||||
if (nextaddr == NULL) {
|
|
||||||
/*
|
|
||||||
* This is the end of the list.
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prevaddr == NULL) {
|
|
||||||
/*
|
|
||||||
* The list was empty; this is the first member.
|
|
||||||
*/
|
|
||||||
curdev->addresses = curaddr;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* "prevaddr" is the last member of the list; append
|
|
||||||
* this member to it.
|
|
||||||
*/
|
|
||||||
prevaddr->next = curaddr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pcap_add_if_win32(pcap_if_t **devlist, char *name, const char *desc,
|
pcap_add_if_win32(pcap_if_t **devlist, char *name, const char *desc,
|
||||||
@@ -189,12 +88,16 @@ pcap_add_if_win32(pcap_if_t **devlist, char *name, const char *desc,
|
|||||||
*/
|
*/
|
||||||
if(curdev == NULL)
|
if(curdev == NULL)
|
||||||
break;
|
break;
|
||||||
res = add_addr_to_list(curdev,
|
res = add_addr_to_dev(curdev,
|
||||||
(struct sockaddr *)&if_addrs[if_addr_size].IPAddress,
|
(struct sockaddr *)&if_addrs[if_addr_size].IPAddress,
|
||||||
|
sizeof (struct sockaddr_storage),
|
||||||
(struct sockaddr *)&if_addrs[if_addr_size].SubnetMask,
|
(struct sockaddr *)&if_addrs[if_addr_size].SubnetMask,
|
||||||
|
sizeof (struct sockaddr_storage),
|
||||||
(struct sockaddr *)&if_addrs[if_addr_size].Broadcast,
|
(struct sockaddr *)&if_addrs[if_addr_size].Broadcast,
|
||||||
|
sizeof (struct sockaddr_storage),
|
||||||
NULL,
|
NULL,
|
||||||
errbuf);
|
0,
|
||||||
|
errbuf);
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
/*
|
/*
|
||||||
* Failure.
|
* Failure.
|
||||||
@@ -224,7 +127,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
char *AdaptersName;
|
char *AdaptersName;
|
||||||
ULONG NameLength;
|
ULONG NameLength;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find out how big a buffer we need.
|
* Find out how big a buffer we need.
|
||||||
*
|
*
|
||||||
@@ -267,7 +170,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
{
|
{
|
||||||
snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot allocate enough memory to list the adapters.");
|
snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot allocate enough memory to list the adapters.");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PacketGetAdapterNames(AdaptersName, &NameLength)) {
|
if (!PacketGetAdapterNames(AdaptersName, &NameLength)) {
|
||||||
snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
||||||
@@ -276,7 +179,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
free(AdaptersName);
|
free(AdaptersName);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "PacketGetAdapterNames()" returned a list of
|
* "PacketGetAdapterNames()" returned a list of
|
||||||
* null-terminated ASCII interface name strings,
|
* null-terminated ASCII interface name strings,
|
||||||
@@ -292,7 +195,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
desc = &AdaptersName[0];
|
desc = &AdaptersName[0];
|
||||||
while (*desc != '\0' || *(desc + 1) != '\0')
|
while (*desc != '\0' || *(desc + 1) != '\0')
|
||||||
desc++;
|
desc++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Found it - "desc" points to the first of the two
|
* Found it - "desc" points to the first of the two
|
||||||
* nulls at the end of the list of names, so the
|
* nulls at the end of the list of names, so the
|
||||||
@@ -300,7 +203,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
* after it.
|
* after it.
|
||||||
*/
|
*/
|
||||||
desc += 2;
|
desc += 2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop over the elements in the first list.
|
* Loop over the elements in the first list.
|
||||||
*/
|
*/
|
||||||
@@ -328,7 +231,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
if (pcap_platform_finddevs(&devlist, errbuf) < 0)
|
if (pcap_platform_finddevs(&devlist, errbuf) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
/*
|
/*
|
||||||
* We had an error; free the list we've been constructing.
|
* We had an error; free the list we've been constructing.
|
||||||
@@ -338,7 +241,7 @@ pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf)
|
|||||||
devlist = NULL;
|
devlist = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*alldevsp = devlist;
|
*alldevsp = devlist;
|
||||||
free(AdaptersName);
|
free(AdaptersName);
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|||||||
2405
libpcap/gencode.c
2405
libpcap/gencode.c
File diff suppressed because it is too large
Load Diff
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/gencode.h,v 1.71 2007-11-18 02:03:52 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -163,7 +161,7 @@
|
|||||||
#define A_CONNECTACK 44 /* Connect Ack message */
|
#define A_CONNECTACK 44 /* Connect Ack message */
|
||||||
#define A_RELEASE 45 /* Release message */
|
#define A_RELEASE 45 /* Release message */
|
||||||
#define A_RELEASE_DONE 46 /* Release message */
|
#define A_RELEASE_DONE 46 /* Release message */
|
||||||
|
|
||||||
/* ATM field types */
|
/* ATM field types */
|
||||||
#define A_VPI 51
|
#define A_VPI 51
|
||||||
#define A_VCI 52
|
#define A_VCI 52
|
||||||
@@ -296,9 +294,9 @@ void gen_not(struct block *);
|
|||||||
struct block *gen_scode(const char *, struct qual);
|
struct block *gen_scode(const char *, struct qual);
|
||||||
struct block *gen_ecode(const u_char *, struct qual);
|
struct block *gen_ecode(const u_char *, struct qual);
|
||||||
struct block *gen_acode(const u_char *, struct qual);
|
struct block *gen_acode(const u_char *, struct qual);
|
||||||
struct block *gen_mcode(const char *, const char *, int, struct qual);
|
struct block *gen_mcode(const char *, const char *, unsigned int, struct qual);
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
struct block *gen_mcode6(const char *, const char *, int, struct qual);
|
struct block *gen_mcode6(const char *, const char *, unsigned int, struct qual);
|
||||||
#endif
|
#endif
|
||||||
struct block *gen_ncode(const char *, bpf_u_int32, struct qual);
|
struct block *gen_ncode(const char *, bpf_u_int32, struct qual);
|
||||||
struct block *gen_proto_abbrev(int);
|
struct block *gen_proto_abbrev(int);
|
||||||
@@ -310,12 +308,21 @@ struct block *gen_broadcast(int);
|
|||||||
struct block *gen_multicast(int);
|
struct block *gen_multicast(int);
|
||||||
struct block *gen_inbound(int);
|
struct block *gen_inbound(int);
|
||||||
|
|
||||||
|
struct block *gen_llc(void);
|
||||||
|
struct block *gen_llc_i(void);
|
||||||
|
struct block *gen_llc_s(void);
|
||||||
|
struct block *gen_llc_u(void);
|
||||||
|
struct block *gen_llc_s_subtype(bpf_u_int32);
|
||||||
|
struct block *gen_llc_u_subtype(bpf_u_int32);
|
||||||
|
|
||||||
struct block *gen_vlan(int);
|
struct block *gen_vlan(int);
|
||||||
struct block *gen_mpls(int);
|
struct block *gen_mpls(int);
|
||||||
|
|
||||||
struct block *gen_pppoed(void);
|
struct block *gen_pppoed(void);
|
||||||
struct block *gen_pppoes(int);
|
struct block *gen_pppoes(int);
|
||||||
|
|
||||||
|
struct block *gen_geneve(int);
|
||||||
|
|
||||||
struct block *gen_atmfield_code(int atmfield, bpf_int32 jvalue, bpf_u_int32 jtype, int reverse);
|
struct block *gen_atmfield_code(int atmfield, bpf_int32 jvalue, bpf_u_int32 jtype, int reverse);
|
||||||
struct block *gen_atmtype_abbrev(int type);
|
struct block *gen_atmtype_abbrev(int type);
|
||||||
struct block *gen_atmmulti_abbrev(int type);
|
struct block *gen_atmmulti_abbrev(int type);
|
||||||
|
|||||||
2142
libpcap/grammar.c
2142
libpcap/grammar.c
File diff suppressed because it is too large
Load Diff
@@ -20,10 +20,6 @@
|
|||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.101 2007-11-18 02:03:52 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -58,6 +54,7 @@ struct rtentry;
|
|||||||
#include <net/pfvar.h>
|
#include <net/pfvar.h>
|
||||||
#include <net/if_pflog.h>
|
#include <net/if_pflog.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "llc.h"
|
||||||
#include "ieee80211.h"
|
#include "ieee80211.h"
|
||||||
#include <pcap/namedb.h>
|
#include <pcap/namedb.h>
|
||||||
|
|
||||||
@@ -132,6 +129,23 @@ static const struct tok ieee80211_data_subtypes[] = {
|
|||||||
{ IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "qos-cf-ack-poll" },
|
{ IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "qos-cf-ack-poll" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
static const struct tok llc_s_subtypes[] = {
|
||||||
|
{ LLC_RR, "rr" },
|
||||||
|
{ LLC_RNR, "rnr" },
|
||||||
|
{ LLC_REJ, "rej" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
static const struct tok llc_u_subtypes[] = {
|
||||||
|
{ LLC_UI, "ui" },
|
||||||
|
{ LLC_UA, "ua" },
|
||||||
|
{ LLC_DISC, "disc" },
|
||||||
|
{ LLC_DM, "dm" },
|
||||||
|
{ LLC_SABME, "sabme" },
|
||||||
|
{ LLC_TEST, "test" },
|
||||||
|
{ LLC_XID, "xid" },
|
||||||
|
{ LLC_FRMR, "frmr" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
struct type2tok {
|
struct type2tok {
|
||||||
int type;
|
int type;
|
||||||
const struct tok *tok;
|
const struct tok *tok;
|
||||||
@@ -261,7 +275,7 @@ pfaction_to_num(const char *action)
|
|||||||
%type <a> arth narth
|
%type <a> arth narth
|
||||||
%type <i> byteop pname pnum relop irelop
|
%type <i> byteop pname pnum relop irelop
|
||||||
%type <blk> and or paren not null prog
|
%type <blk> and or paren not null prog
|
||||||
%type <rblk> other pfvar p80211
|
%type <rblk> other pfvar p80211 pllc
|
||||||
%type <i> atmtype atmmultitype
|
%type <i> atmtype atmmultitype
|
||||||
%type <blk> atmfield
|
%type <blk> atmfield
|
||||||
%type <blk> atmfieldvalue atmvalue atmlistvalue
|
%type <blk> atmfieldvalue atmvalue atmlistvalue
|
||||||
@@ -285,8 +299,8 @@ pfaction_to_num(const char *action)
|
|||||||
%token LEN
|
%token LEN
|
||||||
%token IPV6 ICMPV6 AH ESP
|
%token IPV6 ICMPV6 AH ESP
|
||||||
%token VLAN MPLS
|
%token VLAN MPLS
|
||||||
%token PPPOED PPPOES
|
%token PPPOED PPPOES GENEVE
|
||||||
%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP
|
%token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP
|
||||||
%token STP
|
%token STP
|
||||||
%token IPX
|
%token IPX
|
||||||
%token NETBEUI
|
%token NETBEUI
|
||||||
@@ -296,7 +310,7 @@ pfaction_to_num(const char *action)
|
|||||||
%token RADIO
|
%token RADIO
|
||||||
%token FISU LSSU MSU HFISU HLSSU HMSU
|
%token FISU LSSU MSU HFISU HLSSU HMSU
|
||||||
%token SIO OPC DPC SLS HSIO HOPC HDPC HSLS
|
%token SIO OPC DPC SLS HSIO HOPC HDPC HSLS
|
||||||
|
|
||||||
|
|
||||||
%type <s> ID
|
%type <s> ID
|
||||||
%type <e> EID
|
%type <e> EID
|
||||||
@@ -372,7 +386,7 @@ nid: ID { $$.b = gen_scode($1, $$.q = $<blk>0.q); }
|
|||||||
"in this configuration");
|
"in this configuration");
|
||||||
#endif /*INET6*/
|
#endif /*INET6*/
|
||||||
}
|
}
|
||||||
| EID {
|
| EID {
|
||||||
$$.b = gen_ecode($1, $$.q = $<blk>0.q);
|
$$.b = gen_ecode($1, $$.q = $<blk>0.q);
|
||||||
/*
|
/*
|
||||||
* $1 was allocated by "pcap_ether_aton()",
|
* $1 was allocated by "pcap_ether_aton()",
|
||||||
@@ -509,8 +523,11 @@ other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
|
|||||||
| PPPOED { $$ = gen_pppoed(); }
|
| PPPOED { $$ = gen_pppoed(); }
|
||||||
| PPPOES pnum { $$ = gen_pppoes($2); }
|
| PPPOES pnum { $$ = gen_pppoes($2); }
|
||||||
| PPPOES { $$ = gen_pppoes(-1); }
|
| PPPOES { $$ = gen_pppoes(-1); }
|
||||||
|
| GENEVE pnum { $$ = gen_geneve($2); }
|
||||||
|
| GENEVE { $$ = gen_geneve(-1); }
|
||||||
| pfvar { $$ = $1; }
|
| pfvar { $$ = $1; }
|
||||||
| pqual p80211 { $$ = $2; }
|
| pqual p80211 { $$ = $2; }
|
||||||
|
| pllc { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
pfvar: PF_IFNAME ID { $$ = gen_pf_ifname($2); }
|
pfvar: PF_IFNAME ID { $$ = gen_pf_ifname($2); }
|
||||||
@@ -580,6 +597,31 @@ type_subtype: ID { int i;
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
pllc: LLC { $$ = gen_llc(); }
|
||||||
|
| LLC ID { if (pcap_strcasecmp($2, "i") == 0)
|
||||||
|
$$ = gen_llc_i();
|
||||||
|
else if (pcap_strcasecmp($2, "s") == 0)
|
||||||
|
$$ = gen_llc_s();
|
||||||
|
else if (pcap_strcasecmp($2, "u") == 0)
|
||||||
|
$$ = gen_llc_u();
|
||||||
|
else {
|
||||||
|
u_int subtype;
|
||||||
|
|
||||||
|
subtype = str2tok($2, llc_s_subtypes);
|
||||||
|
if (subtype != -1)
|
||||||
|
$$ = gen_llc_s_subtype(subtype);
|
||||||
|
else {
|
||||||
|
subtype = str2tok($2, llc_u_subtypes);
|
||||||
|
if (subtype == -1)
|
||||||
|
bpf_error("unknown LLC type name \"%s\"", $2);
|
||||||
|
$$ = gen_llc_u_subtype(subtype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* sigh, "rnr" is already a keyword for PF */
|
||||||
|
| LLC PF_RNR { $$ = gen_llc_s_subtype(LLC_RNR); }
|
||||||
|
;
|
||||||
|
|
||||||
dir: NUM
|
dir: NUM
|
||||||
| ID { if (pcap_strcasecmp($1, "nods") == 0)
|
| ID { if (pcap_strcasecmp($1, "nods") == 0)
|
||||||
$$ = IEEE80211_FC1_DIR_NODS;
|
$$ = IEEE80211_FC1_DIR_NODS;
|
||||||
@@ -618,8 +660,10 @@ narth: pname '[' arth ']' { $$ = gen_load($1, $3, 1); }
|
|||||||
| arth '-' arth { $$ = gen_arth(BPF_SUB, $1, $3); }
|
| arth '-' arth { $$ = gen_arth(BPF_SUB, $1, $3); }
|
||||||
| arth '*' arth { $$ = gen_arth(BPF_MUL, $1, $3); }
|
| arth '*' arth { $$ = gen_arth(BPF_MUL, $1, $3); }
|
||||||
| arth '/' arth { $$ = gen_arth(BPF_DIV, $1, $3); }
|
| arth '/' arth { $$ = gen_arth(BPF_DIV, $1, $3); }
|
||||||
|
| arth '%' arth { $$ = gen_arth(BPF_MOD, $1, $3); }
|
||||||
| arth '&' arth { $$ = gen_arth(BPF_AND, $1, $3); }
|
| arth '&' arth { $$ = gen_arth(BPF_AND, $1, $3); }
|
||||||
| arth '|' arth { $$ = gen_arth(BPF_OR, $1, $3); }
|
| arth '|' arth { $$ = gen_arth(BPF_OR, $1, $3); }
|
||||||
|
| arth '^' arth { $$ = gen_arth(BPF_XOR, $1, $3); }
|
||||||
| arth LSH arth { $$ = gen_arth(BPF_LSH, $1, $3); }
|
| arth LSH arth { $$ = gen_arth(BPF_LSH, $1, $3); }
|
||||||
| arth RSH arth { $$ = gen_arth(BPF_RSH, $1, $3); }
|
| arth RSH arth { $$ = gen_arth(BPF_RSH, $1, $3); }
|
||||||
| '-' arth %prec UMINUS { $$ = gen_neg($2); }
|
| '-' arth %prec UMINUS { $$ = gen_neg($2); }
|
||||||
@@ -636,7 +680,6 @@ pnum: NUM
|
|||||||
| paren pnum ')' { $$ = $2; }
|
| paren pnum ')' { $$ = $2; }
|
||||||
;
|
;
|
||||||
atmtype: LANE { $$ = A_LANE; }
|
atmtype: LANE { $$ = A_LANE; }
|
||||||
| LLC { $$ = A_LLC; }
|
|
||||||
| METAC { $$ = A_METAC; }
|
| METAC { $$ = A_METAC; }
|
||||||
| BCC { $$ = A_BCC; }
|
| BCC { $$ = A_BCC; }
|
||||||
| OAMF4EC { $$ = A_OAMF4EC; }
|
| OAMF4EC { $$ = A_OAMF4EC; }
|
||||||
|
|||||||
334
libpcap/inet.c
334
libpcap/inet.c
@@ -32,11 +32,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.79 2008-04-20 18:19:02 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -90,6 +85,18 @@ struct rtentry; /* declarations in <net/if.h> */
|
|||||||
(isdigit((unsigned char)((name)[2])) || (name)[2] == '\0'))
|
(isdigit((unsigned char)((name)[2])) || (name)[2] == '\0'))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef IFF_UP
|
||||||
|
#define ISUP(flags) ((flags) & IFF_UP)
|
||||||
|
#else
|
||||||
|
#define ISUP(flags) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IFF_RUNNING
|
||||||
|
#define ISRUNNING(flags) ((flags) & IFF_RUNNING)
|
||||||
|
#else
|
||||||
|
#define ISRUNNING(flags) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sockaddr *
|
struct sockaddr *
|
||||||
dup_sockaddr(struct sockaddr *sa, size_t sa_length)
|
dup_sockaddr(struct sockaddr *sa, size_t sa_length)
|
||||||
{
|
{
|
||||||
@@ -100,40 +107,85 @@ dup_sockaddr(struct sockaddr *sa, size_t sa_length)
|
|||||||
return (memcpy(newsa, sa, sa_length));
|
return (memcpy(newsa, sa, sa_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
/*
|
||||||
get_instance(const char *name)
|
* Construct a "figure of merit" for an interface, for use when sorting
|
||||||
|
* the list of interfaces, in which interfaces that are up are superior
|
||||||
|
* to interfaces that aren't up, interfaces that are up and running are
|
||||||
|
* superior to interfaces that are up but not running, and non-loopback
|
||||||
|
* interfaces that are up and running are superior to loopback interfaces,
|
||||||
|
* and interfaces with the same flags have a figure of merit that's higher
|
||||||
|
* the lower the instance number.
|
||||||
|
*
|
||||||
|
* The goal is to try to put the interfaces most likely to be useful for
|
||||||
|
* capture at the beginning of the list.
|
||||||
|
*
|
||||||
|
* The figure of merit, which is lower the "better" the interface is,
|
||||||
|
* has the uppermost bit set if the interface isn't running, the bit
|
||||||
|
* below that set if the interface isn't up, the bit below that set
|
||||||
|
* if the interface is a loopback interface, and the interface index
|
||||||
|
* in the 29 bits below that. (Yes, we assume u_int is 32 bits.)
|
||||||
|
*/
|
||||||
|
static u_int
|
||||||
|
get_figure_of_merit(pcap_if_t *dev)
|
||||||
{
|
{
|
||||||
const char *cp, *endcp;
|
const char *cp;
|
||||||
int n;
|
u_int n;
|
||||||
|
|
||||||
if (strcmp(name, "any") == 0) {
|
if (strcmp(dev->name, "any") == 0) {
|
||||||
/*
|
/*
|
||||||
* Give the "any" device an artificially high instance
|
* Give the "any" device an artificially high instance
|
||||||
* number, so it shows up after all other non-loopback
|
* number, so it shows up after all other non-loopback
|
||||||
* interfaces.
|
* interfaces.
|
||||||
*/
|
*/
|
||||||
return INT_MAX;
|
n = 0x1FFFFFFF; /* 29 all-1 bits */
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* A number at the end of the device name string is
|
||||||
|
* assumed to be a unit number.
|
||||||
|
*/
|
||||||
|
cp = dev->name + strlen(dev->name) - 1;
|
||||||
|
while (cp-1 >= dev->name && *(cp-1) >= '0' && *(cp-1) <= '9')
|
||||||
|
cp--;
|
||||||
|
if (*cp >= '0' && *cp <= '9')
|
||||||
|
n = atoi(cp);
|
||||||
|
else
|
||||||
|
n = 0;
|
||||||
}
|
}
|
||||||
|
if (!(dev->flags & PCAP_IF_RUNNING))
|
||||||
endcp = name + strlen(name);
|
n |= 0x80000000;
|
||||||
for (cp = name; cp < endcp && !isdigit((unsigned char)*cp); ++cp)
|
if (!(dev->flags & PCAP_IF_UP))
|
||||||
continue;
|
n |= 0x40000000;
|
||||||
|
if (dev->flags & PCAP_IF_LOOPBACK)
|
||||||
if (isdigit((unsigned char)*cp))
|
n |= 0x20000000;
|
||||||
n = atoi(cp);
|
|
||||||
else
|
|
||||||
n = 0;
|
|
||||||
return (n);
|
return (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Look for a given device in the specified list of devices.
|
||||||
|
*
|
||||||
|
* If we find it, return 0 and set *curdev_ret to point to it.
|
||||||
|
*
|
||||||
|
* If we don't find it, check whether we can open it:
|
||||||
|
*
|
||||||
|
* If that fails with PCAP_ERROR_NO_SUCH_DEVICE or
|
||||||
|
* PCAP_ERROR_IFACE_NOT_UP, don't attempt to add an entry for
|
||||||
|
* it, as that probably means it exists but doesn't support
|
||||||
|
* packet capture.
|
||||||
|
*
|
||||||
|
* Otherwise, attempt to add an entry for it, with the specified
|
||||||
|
* ifnet flags and description, and, if that succeeds, return 0
|
||||||
|
* and set *curdev_ret to point to the new entry, otherwise
|
||||||
|
* return PCAP_ERROR and set errbuf to an error message.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
|
add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
|
||||||
u_int flags, const char *description, char *errbuf)
|
u_int flags, const char *description, char *errbuf)
|
||||||
{
|
{
|
||||||
pcap_t *p;
|
pcap_t *p;
|
||||||
pcap_if_t *curdev, *prevdev, *nextdev;
|
pcap_if_t *curdev, *prevdev, *nextdev;
|
||||||
int this_instance;
|
u_int this_figure_of_merit, nextdev_figure_of_merit;
|
||||||
char open_errbuf[PCAP_ERRBUF_SIZE];
|
char open_errbuf[PCAP_ERRBUF_SIZE];
|
||||||
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is there already an entry in the list for this interface?
|
* Is there already an entry in the list for this interface?
|
||||||
@@ -193,23 +245,72 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
|
|||||||
}
|
}
|
||||||
strcpy(en_name, "en");
|
strcpy(en_name, "en");
|
||||||
strcat(en_name, name + 3);
|
strcat(en_name, name + 3);
|
||||||
p = pcap_open_live(en_name, 68, 0, 0, open_errbuf);
|
p = pcap_create(en_name, open_errbuf);
|
||||||
free(en_name);
|
free(en_name);
|
||||||
} else
|
} else
|
||||||
#endif /* __APPLE */
|
#endif /* __APPLE */
|
||||||
p = pcap_open_live(name, 68, 0, 0, open_errbuf);
|
p = pcap_create(name, open_errbuf);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
/*
|
/*
|
||||||
* No. Don't bother including it.
|
* The attempt to create the pcap_t failed;
|
||||||
* Don't treat this as an error, though.
|
* that's probably an indication that we're
|
||||||
|
* out of memory.
|
||||||
|
*
|
||||||
|
* Don't bother including this interface,
|
||||||
|
* but don't treat it as an error.
|
||||||
*/
|
*/
|
||||||
*curdev_ret = NULL;
|
*curdev_ret = NULL;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
/* Small snaplen, so we don't try to allocate much memory. */
|
||||||
|
pcap_set_snaplen(p, 68);
|
||||||
|
ret = pcap_activate(p);
|
||||||
pcap_close(p);
|
pcap_close(p);
|
||||||
|
switch (ret) {
|
||||||
|
|
||||||
|
case PCAP_ERROR_NO_SUCH_DEVICE:
|
||||||
|
case PCAP_ERROR_IFACE_NOT_UP:
|
||||||
|
/*
|
||||||
|
* We expect these two errors - they're the
|
||||||
|
* reason we try to open the device.
|
||||||
|
*
|
||||||
|
* PCAP_ERROR_NO_SUCH_DEVICE typically means
|
||||||
|
* "there's no such device *known to the
|
||||||
|
* OS's capture mechanism*", so, even though
|
||||||
|
* it might be a valid network interface, you
|
||||||
|
* can't capture on it (e.g., the loopback
|
||||||
|
* device in Solaris up to Solaris 10, or
|
||||||
|
* the vmnet devices in OS X with VMware
|
||||||
|
* Fusion). We don't include those devices
|
||||||
|
* in our list of devices, as there's no
|
||||||
|
* point in doing so - they're not available
|
||||||
|
* for capture.
|
||||||
|
*
|
||||||
|
* PCAP_ERROR_IFACE_NOT_UP means that the
|
||||||
|
* OS's capture mechanism doesn't work on
|
||||||
|
* interfaces not marked as up; some capture
|
||||||
|
* mechanisms *do* support that, so we no
|
||||||
|
* longer reject those interfaces out of hand,
|
||||||
|
* but we *do* want to reject them if they
|
||||||
|
* can't be opened for capture.
|
||||||
|
*/
|
||||||
|
*curdev_ret = NULL;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Yes, we can open it.
|
* Yes, we can open it, or we can't, for some other
|
||||||
|
* reason.
|
||||||
|
*
|
||||||
|
* If we can open it, we want to offer it for
|
||||||
|
* capture, as you can capture on it. If we can't,
|
||||||
|
* we want to offer it for capture, so that, if
|
||||||
|
* the user tries to capture on it, they'll get
|
||||||
|
* an error and they'll know why they can't
|
||||||
|
* capture on it (e.g., insufficient permissions)
|
||||||
|
* or they'll report it as a problem (and then
|
||||||
|
* have the error message to provide as information).
|
||||||
|
*
|
||||||
* Allocate a new entry.
|
* Allocate a new entry.
|
||||||
*/
|
*/
|
||||||
curdev = malloc(sizeof(pcap_if_t));
|
curdev = malloc(sizeof(pcap_if_t));
|
||||||
@@ -252,20 +353,22 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
|
|||||||
curdev->flags = 0;
|
curdev->flags = 0;
|
||||||
if (ISLOOPBACK(name, flags))
|
if (ISLOOPBACK(name, flags))
|
||||||
curdev->flags |= PCAP_IF_LOOPBACK;
|
curdev->flags |= PCAP_IF_LOOPBACK;
|
||||||
|
if (ISUP(flags))
|
||||||
|
curdev->flags |= PCAP_IF_UP;
|
||||||
|
if (ISRUNNING(flags))
|
||||||
|
curdev->flags |= PCAP_IF_RUNNING;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add it to the list, in the appropriate location.
|
* Add it to the list, in the appropriate location.
|
||||||
* First, get the instance number of this interface.
|
* First, get the "figure of merit" for this
|
||||||
|
* interface.
|
||||||
*/
|
*/
|
||||||
this_instance = get_instance(name);
|
this_figure_of_merit = get_figure_of_merit(curdev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now look for the last interface with an instance number
|
* Now look for the last interface with an figure of merit
|
||||||
* less than or equal to the new interface's instance
|
* less than or equal to the new interface's figure of
|
||||||
* number - except that non-loopback interfaces are
|
* merit.
|
||||||
* arbitrarily treated as having interface numbers less
|
|
||||||
* than those of loopback interfaces, so the loopback
|
|
||||||
* interfaces are put at the end of the list.
|
|
||||||
*
|
*
|
||||||
* We start with "prevdev" being NULL, meaning we're before
|
* We start with "prevdev" being NULL, meaning we're before
|
||||||
* the first element in the list.
|
* the first element in the list.
|
||||||
@@ -295,34 +398,13 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is the new interface a non-loopback interface
|
* Is the new interface's figure of merit less
|
||||||
* and the next interface a loopback interface?
|
* than the next interface's figure of merit,
|
||||||
|
* meaning that the new interface is better
|
||||||
|
* than the next interface?
|
||||||
*/
|
*/
|
||||||
if (!(curdev->flags & PCAP_IF_LOOPBACK) &&
|
nextdev_figure_of_merit = get_figure_of_merit(nextdev);
|
||||||
(nextdev->flags & PCAP_IF_LOOPBACK)) {
|
if (this_figure_of_merit < nextdev_figure_of_merit) {
|
||||||
/*
|
|
||||||
* Yes, we should put the new entry
|
|
||||||
* before "nextdev", i.e. after "prevdev".
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Is the new interface's instance number less
|
|
||||||
* than the next interface's instance number,
|
|
||||||
* and is it the case that the new interface is a
|
|
||||||
* non-loopback interface or the next interface is
|
|
||||||
* a loopback interface?
|
|
||||||
*
|
|
||||||
* (The goal of both loopback tests is to make
|
|
||||||
* sure that we never put a loopback interface
|
|
||||||
* before any non-loopback interface and that we
|
|
||||||
* always put a non-loopback interface before all
|
|
||||||
* loopback interfaces.)
|
|
||||||
*/
|
|
||||||
if (this_instance < get_instance(nextdev->name) &&
|
|
||||||
(!(curdev->flags & PCAP_IF_LOOPBACK) ||
|
|
||||||
(nextdev->flags & PCAP_IF_LOOPBACK))) {
|
|
||||||
/*
|
/*
|
||||||
* Yes - we should put the new entry
|
* Yes - we should put the new entry
|
||||||
* before "nextdev", i.e. after "prevdev".
|
* before "nextdev", i.e. after "prevdev".
|
||||||
@@ -358,6 +440,9 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* Try to get a description for a given device.
|
||||||
|
* Returns a mallocated description if it could and NULL if it couldn't.
|
||||||
|
*
|
||||||
* XXX - on FreeBSDs that support it, should it get the sysctl named
|
* XXX - on FreeBSDs that support it, should it get the sysctl named
|
||||||
* "dev.{adapter family name}.{adapter unit}.%desc" to get a description
|
* "dev.{adapter family name}.{adapter unit}.%desc" to get a description
|
||||||
* of the adapter? Note that "dev.an.0.%desc" is "Aironet PC4500/PC4800"
|
* of the adapter? Note that "dev.an.0.%desc" is "Aironet PC4500/PC4800"
|
||||||
@@ -403,18 +488,11 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name,
|
|||||||
* Do any other UN*Xes, or desktop environments support getting a
|
* Do any other UN*Xes, or desktop environments support getting a
|
||||||
* description?
|
* description?
|
||||||
*/
|
*/
|
||||||
int
|
static char *
|
||||||
add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
|
get_if_description(const char *name)
|
||||||
struct sockaddr *addr, size_t addr_size,
|
|
||||||
struct sockaddr *netmask, size_t netmask_size,
|
|
||||||
struct sockaddr *broadaddr, size_t broadaddr_size,
|
|
||||||
struct sockaddr *dstaddr, size_t dstaddr_size,
|
|
||||||
char *errbuf)
|
|
||||||
{
|
{
|
||||||
pcap_if_t *curdev;
|
|
||||||
char *description = NULL;
|
|
||||||
pcap_addr_t *curaddr, *prevaddr, *nextaddr;
|
|
||||||
#ifdef SIOCGIFDESCR
|
#ifdef SIOCGIFDESCR
|
||||||
|
char *description = NULL;
|
||||||
int s;
|
int s;
|
||||||
struct ifreq ifrdesc;
|
struct ifreq ifrdesc;
|
||||||
#ifndef IFDESCRSIZE
|
#ifndef IFDESCRSIZE
|
||||||
@@ -422,9 +500,7 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
|
|||||||
#else
|
#else
|
||||||
size_t descrlen = IFDESCRSIZE;
|
size_t descrlen = IFDESCRSIZE;
|
||||||
#endif /* IFDESCRSIZE */
|
#endif /* IFDESCRSIZE */
|
||||||
#endif /* SIOCGIFDESCR */
|
|
||||||
|
|
||||||
#ifdef SIOCGIFDESCR
|
|
||||||
/*
|
/*
|
||||||
* Get the description for the interface.
|
* Get the description for the interface.
|
||||||
*/
|
*/
|
||||||
@@ -485,8 +561,53 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
|
|||||||
description = NULL;
|
description = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SIOCGIFDESCR */
|
|
||||||
|
|
||||||
|
return (description);
|
||||||
|
#else /* SIOCGIFDESCR */
|
||||||
|
return (NULL);
|
||||||
|
#endif /* SIOCGIFDESCR */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to get a description for a given device, and then look for that
|
||||||
|
* device in the specified list of devices.
|
||||||
|
*
|
||||||
|
* If we find it, then, if the specified address isn't null, add it to
|
||||||
|
* the list of addresses for the device and return 0.
|
||||||
|
*
|
||||||
|
* If we don't find it, check whether we can open it:
|
||||||
|
*
|
||||||
|
* If that fails with PCAP_ERROR_NO_SUCH_DEVICE or
|
||||||
|
* PCAP_ERROR_IFACE_NOT_UP, don't attempt to add an entry for
|
||||||
|
* it, as that probably means it exists but doesn't support
|
||||||
|
* packet capture.
|
||||||
|
*
|
||||||
|
* Otherwise, attempt to add an entry for it, with the specified
|
||||||
|
* ifnet flags and description, and, if that succeeds, add the
|
||||||
|
* specified address to its list of addresses if that address is
|
||||||
|
* non-null, set *curdev_ret to point to the new entry, and
|
||||||
|
* return 0, otherwise return PCAP_ERROR and set errbuf to an
|
||||||
|
* error message.
|
||||||
|
*
|
||||||
|
* (We can get called with a null address because we might get a list
|
||||||
|
* of interface name/address combinations from the underlying OS, with
|
||||||
|
* the address being absent in some cases, rather than a list of
|
||||||
|
* interfaces with each interface having a list of addresses, so this
|
||||||
|
* call may be the only call made to add to the list, and we want to
|
||||||
|
* add interfaces even if they have no addresses.)
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
|
||||||
|
struct sockaddr *addr, size_t addr_size,
|
||||||
|
struct sockaddr *netmask, size_t netmask_size,
|
||||||
|
struct sockaddr *broadaddr, size_t broadaddr_size,
|
||||||
|
struct sockaddr *dstaddr, size_t dstaddr_size,
|
||||||
|
char *errbuf)
|
||||||
|
{
|
||||||
|
char *description;
|
||||||
|
pcap_if_t *curdev;
|
||||||
|
|
||||||
|
description = get_if_description(name);
|
||||||
if (add_or_find_if(&curdev, alldevs, name, flags, description,
|
if (add_or_find_if(&curdev, alldevs, name, flags, description,
|
||||||
errbuf) == -1) {
|
errbuf) == -1) {
|
||||||
free(description);
|
free(description);
|
||||||
@@ -504,12 +625,42 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (addr == NULL) {
|
||||||
|
/*
|
||||||
|
* There's no address to add; this entry just meant
|
||||||
|
* "here's a new interface".
|
||||||
|
*/
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "curdev" is an entry for this interface; add an entry for this
|
* "curdev" is an entry for this interface, and we have an
|
||||||
* address to its list of addresses.
|
* address for it; add an entry for that address to the
|
||||||
|
* interface's list of addresses.
|
||||||
*
|
*
|
||||||
* Allocate the new entry and fill it in.
|
* Allocate the new entry and fill it in.
|
||||||
*/
|
*/
|
||||||
|
return (add_addr_to_dev(curdev, addr, addr_size, netmask,
|
||||||
|
netmask_size, broadaddr, broadaddr_size, dstaddr,
|
||||||
|
dstaddr_size, errbuf));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add an entry to the list of addresses for an interface.
|
||||||
|
* "curdev" is the entry for that interface.
|
||||||
|
* If this is the first IP address added to the interface, move it
|
||||||
|
* in the list as appropriate.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
add_addr_to_dev(pcap_if_t *curdev,
|
||||||
|
struct sockaddr *addr, size_t addr_size,
|
||||||
|
struct sockaddr *netmask, size_t netmask_size,
|
||||||
|
struct sockaddr *broadaddr, size_t broadaddr_size,
|
||||||
|
struct sockaddr *dstaddr, size_t dstaddr_size,
|
||||||
|
char *errbuf)
|
||||||
|
{
|
||||||
|
pcap_addr_t *curaddr, *prevaddr, *nextaddr;
|
||||||
|
|
||||||
curaddr = malloc(sizeof(pcap_addr_t));
|
curaddr = malloc(sizeof(pcap_addr_t));
|
||||||
if (curaddr == NULL) {
|
if (curaddr == NULL) {
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
||||||
@@ -603,6 +754,23 @@ add_addr_to_iflist(pcap_if_t **alldevs, const char *name, u_int flags,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Look for a given device in the specified list of devices.
|
||||||
|
*
|
||||||
|
* If we find it, return 0.
|
||||||
|
*
|
||||||
|
* If we don't find it, check whether we can open it:
|
||||||
|
*
|
||||||
|
* If that fails with PCAP_ERROR_NO_SUCH_DEVICE or
|
||||||
|
* PCAP_ERROR_IFACE_NOT_UP, don't attempt to add an entry for
|
||||||
|
* it, as that probably means it exists but doesn't support
|
||||||
|
* packet capture.
|
||||||
|
*
|
||||||
|
* Otherwise, attempt to add an entry for it, with the specified
|
||||||
|
* ifnet flags and description, and, if that succeeds, return 0
|
||||||
|
* and set *curdev_ret to point to the new entry, otherwise
|
||||||
|
* return PCAP_ERROR and set errbuf to an error message.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
pcap_add_if(pcap_if_t **devlist, const char *name, u_int flags,
|
pcap_add_if(pcap_if_t **devlist, const char *name, u_int flags,
|
||||||
const char *description, char *errbuf)
|
const char *description, char *errbuf)
|
||||||
@@ -756,7 +924,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
|
|||||||
/* XXX Work around Linux kernel bug */
|
/* XXX Work around Linux kernel bug */
|
||||||
ifr.ifr_addr.sa_family = AF_INET;
|
ifr.ifr_addr.sa_family = AF_INET;
|
||||||
#endif
|
#endif
|
||||||
(void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
|
(void)strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
|
||||||
if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
|
if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
|
||||||
if (errno == EADDRNOTAVAIL) {
|
if (errno == EADDRNOTAVAIL) {
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
||||||
@@ -776,7 +944,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
|
|||||||
/* XXX Work around Linux kernel bug */
|
/* XXX Work around Linux kernel bug */
|
||||||
ifr.ifr_addr.sa_family = AF_INET;
|
ifr.ifr_addr.sa_family = AF_INET;
|
||||||
#endif
|
#endif
|
||||||
(void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
|
(void)strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
|
||||||
if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) < 0) {
|
if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) < 0) {
|
||||||
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
|
||||||
"SIOCGIFNETMASK: %s: %s", device, pcap_strerror(errno));
|
"SIOCGIFNETMASK: %s: %s", device, pcap_strerror(errno));
|
||||||
@@ -817,14 +985,14 @@ pcap_lookupdev(errbuf)
|
|||||||
DWORD dwWindowsMajorVersion;
|
DWORD dwWindowsMajorVersion;
|
||||||
dwVersion = GetVersion(); /* get the OS version */
|
dwVersion = GetVersion(); /* get the OS version */
|
||||||
dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||||
|
|
||||||
if (dwVersion >= 0x80000000 && dwWindowsMajorVersion >= 4) {
|
if (dwVersion >= 0x80000000 && dwWindowsMajorVersion >= 4) {
|
||||||
/*
|
/*
|
||||||
* Windows 95, 98, ME.
|
* Windows 95, 98, ME.
|
||||||
*/
|
*/
|
||||||
ULONG NameLength = 8192;
|
ULONG NameLength = 8192;
|
||||||
static char AdaptersName[8192];
|
static char AdaptersName[8192];
|
||||||
|
|
||||||
if (PacketGetAdapterNames(AdaptersName,&NameLength) )
|
if (PacketGetAdapterNames(AdaptersName,&NameLength) )
|
||||||
return (AdaptersName);
|
return (AdaptersName);
|
||||||
else
|
else
|
||||||
@@ -887,7 +1055,7 @@ pcap_lookupdev(errbuf)
|
|||||||
|
|
||||||
free(TAdaptersName);
|
free(TAdaptersName);
|
||||||
return (char *)(AdaptersName);
|
return (char *)(AdaptersName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -897,7 +1065,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
|
|||||||
register bpf_u_int32 *netp, *maskp;
|
register bpf_u_int32 *netp, *maskp;
|
||||||
register char *errbuf;
|
register char *errbuf;
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We need only the first IPv4 address, so we must scan the array returned by PacketGetNetInfo()
|
* We need only the first IPv4 address, so we must scan the array returned by PacketGetNetInfo()
|
||||||
* in order to skip non IPv4 (i.e. IPv6 addresses)
|
* in order to skip non IPv4 (i.e. IPv6 addresses)
|
||||||
*/
|
*/
|
||||||
@@ -923,7 +1091,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
|
|||||||
*netp &= *maskp;
|
*netp &= *maskp;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*netp = *maskp = 0;
|
*netp = *maskp = 0;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ fi
|
|||||||
if [ x"$dir_arg" != x ]; then
|
if [ x"$dir_arg" != x ]; then
|
||||||
dst=$src
|
dst=$src
|
||||||
src=""
|
src=""
|
||||||
|
|
||||||
if [ -d $dst ]; then
|
if [ -d $dst ]; then
|
||||||
instcmd=:
|
instcmd=:
|
||||||
else
|
else
|
||||||
@@ -124,7 +124,7 @@ if [ x"$dir_arg" != x ]; then
|
|||||||
else
|
else
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
# might cause directories to be created, which would be especially bad
|
# might cause directories to be created, which would be especially bad
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
|
||||||
if [ -f $src -o -d $src ]
|
if [ -f $src -o -d $src ]
|
||||||
@@ -134,7 +134,7 @@ else
|
|||||||
echo "install: $src does not exist"
|
echo "install: $src does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ x"$dst" = x ]
|
if [ x"$dst" = x ]
|
||||||
then
|
then
|
||||||
echo "install: no destination specified"
|
echo "install: no destination specified"
|
||||||
@@ -201,17 +201,17 @@ else
|
|||||||
|
|
||||||
# If we're going to rename the final executable, determine the name now.
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
if [ x"$transformarg" = x ]
|
if [ x"$transformarg" = x ]
|
||||||
then
|
then
|
||||||
dstfile=`basename $dst`
|
dstfile=`basename $dst`
|
||||||
else
|
else
|
||||||
dstfile=`basename $dst $transformbasename |
|
dstfile=`basename $dst $transformbasename |
|
||||||
sed $transformarg`$transformbasename
|
sed $transformarg`$transformbasename
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# don't allow the sed command to completely eliminate the filename
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
if [ x"$dstfile" = x ]
|
if [ x"$dstfile" = x ]
|
||||||
then
|
then
|
||||||
dstfile=`basename $dst`
|
dstfile=`basename $dst`
|
||||||
else
|
else
|
||||||
@@ -242,7 +242,7 @@ else
|
|||||||
# Now rename the file to the real destination.
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
fi &&
|
fi &&
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/lbl/os-aix4.h,v 1.1 2002-06-01 09:37:40 guy Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Prototypes missing in AIX 4.x */
|
/* Prototypes missing in AIX 4.x */
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/lbl/os-hpux11.h,v 1.1 2002-06-01 09:37:41 guy Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Prototypes missing in HP-UX 11.x */
|
/* Prototypes missing in HP-UX 11.x */
|
||||||
|
|||||||
@@ -17,12 +17,10 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/lbl/os-osf4.h,v 1.2 2000-12-22 11:51:33 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Prototypes missing in Digital UNIX 4.x */
|
/* Prototypes missing in Digital UNIX 4.x */
|
||||||
int snprintf(char *, size_t, const char *, ...);
|
int snprintf(char *, size_t, const char *, ...);
|
||||||
int vsnprintf(char *, size_t, const char *, va_list);
|
int vsnprintf(char *, size_t, const char *, va_list);
|
||||||
int pfopen(char *, int);
|
int pfopen(char *, int);
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/lbl/os-osf5.h,v 1.2 2002-08-02 03:24:15 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -29,4 +27,4 @@
|
|||||||
int snprintf(char *, size_t, const char *, ...);
|
int snprintf(char *, size_t, const char *, ...);
|
||||||
int vsnprintf(char *, size_t, const char *, va_list);
|
int vsnprintf(char *, size_t, const char *, va_list);
|
||||||
int pfopen(char *, int);
|
int pfopen(char *, int);
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/lbl/os-solaris2.h,v 1.19 2000-10-11 04:02:52 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Prototypes missing in SunOS 5 */
|
/* Prototypes missing in SunOS 5 */
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/lbl/os-sunos4.h,v 1.32 1999-10-07 23:46:41 mcr Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Prototypes missing in SunOS 4 */
|
/* Prototypes missing in SunOS 4 */
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/lbl/os-ultrix4.h,v 1.19 1999-10-07 23:46:41 mcr Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Prototypes missing in Ultrix 4 */
|
/* Prototypes missing in Ultrix 4 */
|
||||||
|
|||||||
@@ -17,10 +17,39 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/llc.h,v 1.2 2001-01-28 09:44:50 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definitions for information in the LLC header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LLC_U_FMT 3
|
||||||
|
#define LLC_GSAP 1
|
||||||
|
#define LLC_IG 1 /* Individual / Group */
|
||||||
|
#define LLC_S_FMT 1
|
||||||
|
|
||||||
|
#define LLC_U_POLL 0x10
|
||||||
|
#define LLC_IS_POLL 0x0100
|
||||||
|
#define LLC_XID_FI 0x81
|
||||||
|
|
||||||
|
#define LLC_U_CMD_MASK 0xef
|
||||||
|
#define LLC_UI 0x03
|
||||||
|
#define LLC_UA 0x63
|
||||||
|
#define LLC_DISC 0x43
|
||||||
|
#define LLC_DM 0x0f
|
||||||
|
#define LLC_SABME 0x6f
|
||||||
|
#define LLC_TEST 0xe3
|
||||||
|
#define LLC_XID 0xaf
|
||||||
|
#define LLC_FRMR 0x87
|
||||||
|
|
||||||
|
#define LLC_S_CMD_MASK 0x0f
|
||||||
|
#define LLC_RR 0x0001
|
||||||
|
#define LLC_RNR 0x0005
|
||||||
|
#define LLC_REJ 0x0009
|
||||||
|
|
||||||
|
#define LLC_IS_NR(is) (((is) >> 9) & 0x7f)
|
||||||
|
#define LLC_I_NS(is) (((is) >> 1) & 0x7f)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 802.2 LLC SAP values.
|
* 802.2 LLC SAP values.
|
||||||
*/
|
*/
|
||||||
@@ -31,10 +60,10 @@
|
|||||||
#ifndef LLCSAP_GLOBAL
|
#ifndef LLCSAP_GLOBAL
|
||||||
#define LLCSAP_GLOBAL 0xff
|
#define LLCSAP_GLOBAL 0xff
|
||||||
#endif
|
#endif
|
||||||
#ifndef LLCSAP_8021B
|
#ifndef LLCSAP_8021B_I
|
||||||
#define LLCSAP_8021B_I 0x02
|
#define LLCSAP_8021B_I 0x02
|
||||||
#endif
|
#endif
|
||||||
#ifndef LLCSAP_8021B
|
#ifndef LLCSAP_8021B_G
|
||||||
#define LLCSAP_8021B_G 0x03
|
#define LLCSAP_8021B_G 0x03
|
||||||
#endif
|
#endif
|
||||||
#ifndef LLCSAP_IP
|
#ifndef LLCSAP_IP
|
||||||
|
|||||||
@@ -31,17 +31,10 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: snprintf.c,v 1.1 2004-04-05 22:43:51 guy Exp $ */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/missing/snprintf.c,v 1.1 2004-04-05 22:43:51 guy Exp $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -13,9 +13,6 @@
|
|||||||
# @(#)mkdep.sh 5.11 (Berkeley) 5/5/88
|
# @(#)mkdep.sh 5.11 (Berkeley) 5/5/88
|
||||||
#
|
#
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:/usr/ucb:/usr/local:/usr/local/bin:/usr/sfw/bin
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
MAKE=Makefile # default makefile name is "Makefile"
|
MAKE=Makefile # default makefile name is "Makefile"
|
||||||
CC=cc # default C compiler is "cc"
|
CC=cc # default C compiler is "cc"
|
||||||
DEPENDENCY_CFLAG=-M # default dependency-generation flag is -M
|
DEPENDENCY_CFLAG=-M # default dependency-generation flag is -M
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Common defines for libpcap and 16/32-bit network drivers (djgpp)
|
# Common defines for libpcap and 16/32-bit network drivers (djgpp)
|
||||||
#
|
#
|
||||||
# @(#) $Header: /tcpdump/master/libpcap/msdos/common.dj,v 1.2 2004-12-19 19:36:33 guy Exp $ (LBL)
|
|
||||||
|
|
||||||
.SUFFIXES: .exe .wlm .dxe .l .y
|
.SUFFIXES: .exe .wlm .dxe .l .y
|
||||||
.PHONY: check_gcclib
|
.PHONY: check_gcclib
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#
|
#
|
||||||
# c:\net\pcap> make -f msdos/makefile.dj
|
# c:\net\pcap> make -f msdos/makefile.dj
|
||||||
#
|
#
|
||||||
# @(#) $Header: /tcpdump/master/libpcap/msdos/makefile.dj,v 1.2 2004-12-19 19:41:06 guy Exp $ (LBL)
|
|
||||||
|
|
||||||
VPATH = missing msdos
|
VPATH = missing msdos
|
||||||
|
|
||||||
@@ -105,7 +104,7 @@ depend: $(PREREQUISITES)
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Manually generated dependencies
|
# Manually generated dependencies
|
||||||
#
|
#
|
||||||
msdos/pktdrvr.c: msdos/pkt_stub.inc
|
msdos/pktdrvr.c: msdos/pkt_stub.inc
|
||||||
scanner.c: scanner.l
|
scanner.c: scanner.l
|
||||||
grammar.c tokdefs.h: grammar.y
|
grammar.c tokdefs.h: grammar.y
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@(#) $Header: /tcpdump/master/libpcap/msdos/readme.dos,v 1.3 2004-12-19 19:47:01 guy Exp $ (LBL)
|
|
||||||
|
|
||||||
libpcap for DOS
|
libpcap for DOS
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
@@ -134,7 +132,7 @@ Extensions to libpcap
|
|||||||
|
|
||||||
I've included some extra functions to DOS-libpcap:
|
I've included some extra functions to DOS-libpcap:
|
||||||
|
|
||||||
`pcap_config_hook (const char *name, const char *value)'
|
`pcap_config_hook (const char *name, const char *value)'
|
||||||
|
|
||||||
Allows an application to set values of internal libpcap variables.
|
Allows an application to set values of internal libpcap variables.
|
||||||
`name' is typically a left-side keyword with an associated `value'
|
`name' is typically a left-side keyword with an associated `value'
|
||||||
|
|||||||
@@ -22,11 +22,6 @@
|
|||||||
* These functions are not time critical.
|
* These functions are not time critical.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.83 2008-02-06 10:21:30 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/nlpid.h,v 1.2 2002-12-06 00:01:34 hannes Exp $ (Juniper)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Types missing from some systems */
|
/* Types missing from some systems */
|
||||||
|
|||||||
@@ -20,10 +20,6 @@
|
|||||||
*
|
*
|
||||||
* Optimization module for tcpdump intermediate representation.
|
* Optimization module for tcpdump intermediate representation.
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.91 2008-01-02 04:16:46 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -610,6 +606,12 @@ fold_op(struct stmt *s, int v0, int v1)
|
|||||||
a /= b;
|
a /= b;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BPF_MOD:
|
||||||
|
if (b == 0)
|
||||||
|
bpf_error("modulus by zero");
|
||||||
|
a %= b;
|
||||||
|
break;
|
||||||
|
|
||||||
case BPF_AND:
|
case BPF_AND:
|
||||||
a &= b;
|
a &= b;
|
||||||
break;
|
break;
|
||||||
@@ -618,6 +620,10 @@ fold_op(struct stmt *s, int v0, int v1)
|
|||||||
a |= b;
|
a |= b;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BPF_XOR:
|
||||||
|
a ^= b;
|
||||||
|
break;
|
||||||
|
|
||||||
case BPF_LSH:
|
case BPF_LSH:
|
||||||
a <<= b;
|
a <<= b;
|
||||||
break;
|
break;
|
||||||
@@ -978,8 +984,10 @@ opt_stmt(struct stmt *s, int val[], int alter)
|
|||||||
case BPF_ALU|BPF_SUB|BPF_K:
|
case BPF_ALU|BPF_SUB|BPF_K:
|
||||||
case BPF_ALU|BPF_MUL|BPF_K:
|
case BPF_ALU|BPF_MUL|BPF_K:
|
||||||
case BPF_ALU|BPF_DIV|BPF_K:
|
case BPF_ALU|BPF_DIV|BPF_K:
|
||||||
|
case BPF_ALU|BPF_MOD|BPF_K:
|
||||||
case BPF_ALU|BPF_AND|BPF_K:
|
case BPF_ALU|BPF_AND|BPF_K:
|
||||||
case BPF_ALU|BPF_OR|BPF_K:
|
case BPF_ALU|BPF_OR|BPF_K:
|
||||||
|
case BPF_ALU|BPF_XOR|BPF_K:
|
||||||
case BPF_ALU|BPF_LSH|BPF_K:
|
case BPF_ALU|BPF_LSH|BPF_K:
|
||||||
case BPF_ALU|BPF_RSH|BPF_K:
|
case BPF_ALU|BPF_RSH|BPF_K:
|
||||||
op = BPF_OP(s->code);
|
op = BPF_OP(s->code);
|
||||||
@@ -990,7 +998,7 @@ opt_stmt(struct stmt *s, int val[], int alter)
|
|||||||
* fixup the generated math code */
|
* fixup the generated math code */
|
||||||
if (op == BPF_ADD ||
|
if (op == BPF_ADD ||
|
||||||
op == BPF_LSH || op == BPF_RSH ||
|
op == BPF_LSH || op == BPF_RSH ||
|
||||||
op == BPF_OR) {
|
op == BPF_OR || op == BPF_XOR) {
|
||||||
s->code = NOP;
|
s->code = NOP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1013,8 +1021,10 @@ opt_stmt(struct stmt *s, int val[], int alter)
|
|||||||
case BPF_ALU|BPF_SUB|BPF_X:
|
case BPF_ALU|BPF_SUB|BPF_X:
|
||||||
case BPF_ALU|BPF_MUL|BPF_X:
|
case BPF_ALU|BPF_MUL|BPF_X:
|
||||||
case BPF_ALU|BPF_DIV|BPF_X:
|
case BPF_ALU|BPF_DIV|BPF_X:
|
||||||
|
case BPF_ALU|BPF_MOD|BPF_X:
|
||||||
case BPF_ALU|BPF_AND|BPF_X:
|
case BPF_ALU|BPF_AND|BPF_X:
|
||||||
case BPF_ALU|BPF_OR|BPF_X:
|
case BPF_ALU|BPF_OR|BPF_X:
|
||||||
|
case BPF_ALU|BPF_XOR|BPF_X:
|
||||||
case BPF_ALU|BPF_LSH|BPF_X:
|
case BPF_ALU|BPF_LSH|BPF_X:
|
||||||
case BPF_ALU|BPF_RSH|BPF_X:
|
case BPF_ALU|BPF_RSH|BPF_X:
|
||||||
op = BPF_OP(s->code);
|
op = BPF_OP(s->code);
|
||||||
@@ -1041,12 +1051,12 @@ opt_stmt(struct stmt *s, int val[], int alter)
|
|||||||
*/
|
*/
|
||||||
if (alter && vmap[val[A_ATOM]].is_const
|
if (alter && vmap[val[A_ATOM]].is_const
|
||||||
&& vmap[val[A_ATOM]].const_val == 0) {
|
&& vmap[val[A_ATOM]].const_val == 0) {
|
||||||
if (op == BPF_ADD || op == BPF_OR) {
|
if (op == BPF_ADD || op == BPF_OR || op == BPF_XOR) {
|
||||||
s->code = BPF_MISC|BPF_TXA;
|
s->code = BPF_MISC|BPF_TXA;
|
||||||
vstore(s, &val[A_ATOM], val[X_ATOM], alter);
|
vstore(s, &val[A_ATOM], val[X_ATOM], alter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (op == BPF_MUL || op == BPF_DIV ||
|
else if (op == BPF_MUL || op == BPF_DIV || op == BPF_MOD ||
|
||||||
op == BPF_AND || op == BPF_LSH || op == BPF_RSH) {
|
op == BPF_AND || op == BPF_LSH || op == BPF_RSH) {
|
||||||
s->code = BPF_LD|BPF_IMM;
|
s->code = BPF_LD|BPF_IMM;
|
||||||
s->k = 0;
|
s->k = 0;
|
||||||
@@ -2234,7 +2244,92 @@ install_bpf_program(pcap_t *p, struct bpf_program *fp)
|
|||||||
|
|
||||||
#ifdef BDEBUG
|
#ifdef BDEBUG
|
||||||
static void
|
static void
|
||||||
opt_dump(struct block *root)
|
dot_dump_node(struct block *block, struct bpf_program *prog, FILE *out)
|
||||||
|
{
|
||||||
|
int icount, noffset;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (block == NULL || isMarked(block))
|
||||||
|
return;
|
||||||
|
Mark(block);
|
||||||
|
|
||||||
|
icount = slength(block->stmts) + 1 + block->longjt + block->longjf;
|
||||||
|
noffset = min(block->offset + icount, (int)prog->bf_len);
|
||||||
|
|
||||||
|
fprintf(out, "\tblock%d [shape=ellipse, id=\"block-%d\" label=\"BLOCK%d\\n", block->id, block->id, block->id);
|
||||||
|
for (i = block->offset; i < noffset; i++) {
|
||||||
|
fprintf(out, "\\n%s", bpf_image(prog->bf_insns + i, i));
|
||||||
|
}
|
||||||
|
fprintf(out, "\" tooltip=\"");
|
||||||
|
for (i = 0; i < BPF_MEMWORDS; i++)
|
||||||
|
if (block->val[i] != 0)
|
||||||
|
fprintf(out, "val[%d]=%d ", i, block->val[i]);
|
||||||
|
fprintf(out, "val[A]=%d ", block->val[A_ATOM]);
|
||||||
|
fprintf(out, "val[X]=%d", block->val[X_ATOM]);
|
||||||
|
fprintf(out, "\"");
|
||||||
|
if (JT(block) == NULL)
|
||||||
|
fprintf(out, ", peripheries=2");
|
||||||
|
fprintf(out, "];\n");
|
||||||
|
|
||||||
|
dot_dump_node(JT(block), prog, out);
|
||||||
|
dot_dump_node(JF(block), prog, out);
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
dot_dump_edge(struct block *block, FILE *out)
|
||||||
|
{
|
||||||
|
if (block == NULL || isMarked(block))
|
||||||
|
return;
|
||||||
|
Mark(block);
|
||||||
|
|
||||||
|
if (JT(block)) {
|
||||||
|
fprintf(out, "\t\"block%d\":se -> \"block%d\":n [label=\"T\"]; \n",
|
||||||
|
block->id, JT(block)->id);
|
||||||
|
fprintf(out, "\t\"block%d\":sw -> \"block%d\":n [label=\"F\"]; \n",
|
||||||
|
block->id, JF(block)->id);
|
||||||
|
}
|
||||||
|
dot_dump_edge(JT(block), out);
|
||||||
|
dot_dump_edge(JF(block), out);
|
||||||
|
}
|
||||||
|
/* Output the block CFG using graphviz/DOT language
|
||||||
|
* In the CFG, block's code, value index for each registers at EXIT,
|
||||||
|
* and the jump relationship is show.
|
||||||
|
*
|
||||||
|
* example DOT for BPF `ip src host 1.1.1.1' is:
|
||||||
|
digraph BPF {
|
||||||
|
block0 [shape=ellipse, id="block-0" label="BLOCK0\n\n(000) ldh [12]\n(001) jeq #0x800 jt 2 jf 5" tooltip="val[A]=0 val[X]=0"];
|
||||||
|
block1 [shape=ellipse, id="block-1" label="BLOCK1\n\n(002) ld [26]\n(003) jeq #0x1010101 jt 4 jf 5" tooltip="val[A]=0 val[X]=0"];
|
||||||
|
block2 [shape=ellipse, id="block-2" label="BLOCK2\n\n(004) ret #68" tooltip="val[A]=0 val[X]=0", peripheries=2];
|
||||||
|
block3 [shape=ellipse, id="block-3" label="BLOCK3\n\n(005) ret #0" tooltip="val[A]=0 val[X]=0", peripheries=2];
|
||||||
|
"block0":se -> "block1":n [label="T"];
|
||||||
|
"block0":sw -> "block3":n [label="F"];
|
||||||
|
"block1":se -> "block2":n [label="T"];
|
||||||
|
"block1":sw -> "block3":n [label="F"];
|
||||||
|
}
|
||||||
|
*
|
||||||
|
* After install graphviz on http://www.graphviz.org/, save it as bpf.dot
|
||||||
|
* and run `dot -Tpng -O bpf.dot' to draw the graph.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
dot_dump(struct block *root)
|
||||||
|
{
|
||||||
|
struct bpf_program f;
|
||||||
|
FILE *out = stdout;
|
||||||
|
|
||||||
|
memset(bids, 0, sizeof bids);
|
||||||
|
f.bf_insns = icode_to_fcode(root, &f.bf_len);
|
||||||
|
|
||||||
|
fprintf(out, "digraph BPF {\n");
|
||||||
|
unMarkAll();
|
||||||
|
dot_dump_node(root, &f, out);
|
||||||
|
unMarkAll();
|
||||||
|
dot_dump_edge(root, out);
|
||||||
|
fprintf(out, "}\n");
|
||||||
|
|
||||||
|
free((char *)f.bf_insns);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
plain_dump(struct block *root)
|
||||||
{
|
{
|
||||||
struct bpf_program f;
|
struct bpf_program f;
|
||||||
|
|
||||||
@@ -2244,4 +2339,17 @@ opt_dump(struct block *root)
|
|||||||
putchar('\n');
|
putchar('\n');
|
||||||
free((char *)f.bf_insns);
|
free((char *)f.bf_insns);
|
||||||
}
|
}
|
||||||
|
static void
|
||||||
|
opt_dump(struct block *root)
|
||||||
|
{
|
||||||
|
/* if optimizer debugging is enabled, output DOT graph
|
||||||
|
* `dflag=4' is equivalent to -dddd to follow -d/-dd/-ddd
|
||||||
|
* convention in tcpdump command line
|
||||||
|
*/
|
||||||
|
if (dflag > 3)
|
||||||
|
dot_dump(root);
|
||||||
|
else
|
||||||
|
plain_dump(root);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
%define prefix /usr
|
|
||||||
%define version @VERSION@
|
|
||||||
|
|
||||||
Summary: A system-independent interface for user-level packet capture
|
|
||||||
Name: libpcap
|
|
||||||
Version: %version
|
|
||||||
Release: 1
|
|
||||||
Group: Development/Libraries
|
|
||||||
License: BSD with advertising
|
|
||||||
Source: @NAME@.tar.gz
|
|
||||||
BuildRoot: /tmp/%{name}-buildroot
|
|
||||||
URL: http://www.tcpdump.org
|
|
||||||
|
|
||||||
Source: http://www.tcpdump.org/release/%{name}-%{version}.tar.gz
|
|
||||||
|
|
||||||
%description
|
|
||||||
Libpcap provides a portable framework for low-level network
|
|
||||||
monitoring. Libpcap can provide network statistics collection,
|
|
||||||
security monitoring and network debugging. Since almost every system
|
|
||||||
vendor provides a different interface for packet capture, the libpcap
|
|
||||||
authors created this system-independent API to ease in porting and to
|
|
||||||
alleviate the need for several system-dependent packet capture modules
|
|
||||||
in each application.
|
|
||||||
|
|
||||||
Install libpcap if you need to do low-level network traffic monitoring
|
|
||||||
on your network.
|
|
||||||
|
|
||||||
%package devel
|
|
||||||
Summary: Libraries and header files for the libpcap library
|
|
||||||
Group: Development/Libraries
|
|
||||||
|
|
||||||
%description devel
|
|
||||||
Libpcap provides a portable framework for low-level network
|
|
||||||
monitoring. Libpcap can provide network statistics collection,
|
|
||||||
security monitoring and network debugging. Since almost every system
|
|
||||||
vendor provides a different interface for packet capture, the libpcap
|
|
||||||
authors created this system-independent API to ease in porting and to
|
|
||||||
alleviate the need for several system-dependent packet capture modules
|
|
||||||
in each application.
|
|
||||||
|
|
||||||
This package provides the libraries, include files, and other
|
|
||||||
resources needed for developing libpcap applications.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q
|
|
||||||
|
|
||||||
%build
|
|
||||||
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
|
|
||||||
%configure
|
|
||||||
make %{?_smp_mflags}
|
|
||||||
|
|
||||||
%install
|
|
||||||
rm -rf $RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
|
||||||
|
|
||||||
%clean
|
|
||||||
rm -rf $RPM_BUILD_ROOT
|
|
||||||
|
|
||||||
%files
|
|
||||||
%defattr(-,root,root)
|
|
||||||
%doc LICENSE README CHANGES INSTALL.txt README.linux TODO VERSION CREDITS packaging/pcap.spec
|
|
||||||
%{_libdir}/libpcap.so.*
|
|
||||||
%{_mandir}/man7/pcap*.7*
|
|
||||||
|
|
||||||
%files devel
|
|
||||||
%defattr(-,root,root)
|
|
||||||
%{_bindir}/pcap-config
|
|
||||||
%{_includedir}/pcap/*.h
|
|
||||||
%{_includedir}/pcap.h
|
|
||||||
%{_includedir}/pcap-bpf.h
|
|
||||||
%{_includedir}/pcap-namedb.h
|
|
||||||
%{_libdir}/libpcap.so
|
|
||||||
%{_libdir}/libpcap.a
|
|
||||||
%{_mandir}/man1/pcap-config.1*
|
|
||||||
%{_mandir}/man3/pcap*.3*
|
|
||||||
%{_mandir}/man5/pcap*.5*
|
|
||||||
@@ -18,10 +18,6 @@
|
|||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.116 2008-09-16 18:42:29 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -239,7 +235,7 @@ static int pcap_set_datalink_bpf(pcap_t *p, int dlt);
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
pcap_getnonblock_bpf(pcap_t *p, char *errbuf)
|
pcap_getnonblock_bpf(pcap_t *p, char *errbuf)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ZEROCOPY_BPF
|
#ifdef HAVE_ZEROCOPY_BPF
|
||||||
struct pcap_bpf *pb = p->priv;
|
struct pcap_bpf *pb = p->priv;
|
||||||
|
|
||||||
@@ -251,7 +247,7 @@ pcap_getnonblock_bpf(pcap_t *p, char *errbuf)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
pcap_setnonblock_bpf(pcap_t *p, int nonblock, char *errbuf)
|
pcap_setnonblock_bpf(pcap_t *p, int nonblock, char *errbuf)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ZEROCOPY_BPF
|
#ifdef HAVE_ZEROCOPY_BPF
|
||||||
struct pcap_bpf *pb = p->priv;
|
struct pcap_bpf *pb = p->priv;
|
||||||
|
|
||||||
@@ -1480,6 +1476,9 @@ pcap_activate_bpf(pcap_t *p)
|
|||||||
{
|
{
|
||||||
struct pcap_bpf *pb = p->priv;
|
struct pcap_bpf *pb = p->priv;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
#ifdef HAVE_BSD_IEEE80211
|
||||||
|
int retv;
|
||||||
|
#endif
|
||||||
int fd;
|
int fd;
|
||||||
#ifdef LIFNAMSIZ
|
#ifdef LIFNAMSIZ
|
||||||
char *zonesep;
|
char *zonesep;
|
||||||
@@ -1539,22 +1538,43 @@ pcap_activate_bpf(pcap_t *p)
|
|||||||
|
|
||||||
#if defined(LIFNAMSIZ) && defined(ZONENAME_MAX) && defined(lifr_zoneid)
|
#if defined(LIFNAMSIZ) && defined(ZONENAME_MAX) && defined(lifr_zoneid)
|
||||||
/*
|
/*
|
||||||
* Check if the given source network device has a '/' separated
|
* Retrieve the zoneid of the zone we are currently executing in.
|
||||||
* zonename prefix string. The zonename prefixed source device
|
*/
|
||||||
* can be used by libpcap consumers to capture network traffic
|
if ((ifr.lifr_zoneid = getzoneid()) == -1) {
|
||||||
* in non-global zones from the global zone on Solaris 11 and
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "getzoneid(): %s",
|
||||||
* above. If the zonename prefix is present then we strip the
|
pcap_strerror(errno));
|
||||||
* prefix and pass the zone ID as part of lifr_zoneid.
|
status = PCAP_ERROR;
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Check if the given source datalink name has a '/' separated
|
||||||
|
* zonename prefix string. The zonename prefixed source datalink can
|
||||||
|
* be used by pcap consumers in the Solaris global zone to capture
|
||||||
|
* traffic on datalinks in non-global zones. Non-global zones
|
||||||
|
* do not have access to datalinks outside of their own namespace.
|
||||||
*/
|
*/
|
||||||
if ((zonesep = strchr(p->opt.source, '/')) != NULL) {
|
if ((zonesep = strchr(p->opt.source, '/')) != NULL) {
|
||||||
char zonename[ZONENAME_MAX];
|
char path_zname[ZONENAME_MAX];
|
||||||
int znamelen;
|
int znamelen;
|
||||||
char *lnamep;
|
char *lnamep;
|
||||||
|
|
||||||
|
if (ifr.lifr_zoneid != GLOBAL_ZONEID) {
|
||||||
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
"zonename/linkname only valid in global zone.");
|
||||||
|
status = PCAP_ERROR;
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
znamelen = zonesep - p->opt.source;
|
znamelen = zonesep - p->opt.source;
|
||||||
(void) strlcpy(zonename, p->opt.source, znamelen + 1);
|
(void) strlcpy(path_zname, p->opt.source, znamelen + 1);
|
||||||
|
ifr.lifr_zoneid = getzoneidbyname(path_zname);
|
||||||
|
if (ifr.lifr_zoneid == -1) {
|
||||||
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
"getzoneidbyname(%s): %s", path_zname,
|
||||||
|
pcap_strerror(errno));
|
||||||
|
status = PCAP_ERROR;
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
lnamep = strdup(zonesep + 1);
|
lnamep = strdup(zonesep + 1);
|
||||||
ifr.lifr_zoneid = getzoneidbyname(zonename);
|
|
||||||
free(p->opt.source);
|
free(p->opt.source);
|
||||||
p->opt.source = lnamep;
|
p->opt.source = lnamep;
|
||||||
}
|
}
|
||||||
@@ -1683,6 +1703,7 @@ pcap_activate_bpf(pcap_t *p)
|
|||||||
if (ioctl(fd, BIOCGETZMAX, (caddr_t)&zbufmax) < 0) {
|
if (ioctl(fd, BIOCGETZMAX, (caddr_t)&zbufmax) < 0) {
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGETZMAX: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGETZMAX: %s",
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1709,6 +1730,7 @@ pcap_activate_bpf(pcap_t *p)
|
|||||||
if (pb->zbuf1 == MAP_FAILED || pb->zbuf2 == MAP_FAILED) {
|
if (pb->zbuf1 == MAP_FAILED || pb->zbuf2 == MAP_FAILED) {
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "mmap: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "mmap: %s",
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
memset(&bz, 0, sizeof(bz)); /* bzero() deprecated, replaced with memset() */
|
memset(&bz, 0, sizeof(bz)); /* bzero() deprecated, replaced with memset() */
|
||||||
@@ -1718,12 +1740,14 @@ pcap_activate_bpf(pcap_t *p)
|
|||||||
if (ioctl(fd, BIOCSETZBUF, (caddr_t)&bz) < 0) {
|
if (ioctl(fd, BIOCSETZBUF, (caddr_t)&bz) < 0) {
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETZBUF: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETZBUF: %s",
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
(void)strncpy(ifrname, p->opt.source, ifnamsiz);
|
(void)strncpy(ifrname, p->opt.source, ifnamsiz);
|
||||||
if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
|
if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETIF: %s: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETIF: %s: %s",
|
||||||
p->opt.source, pcap_strerror(errno));
|
p->opt.source, pcap_strerror(errno));
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
v = pb->zbufsize - sizeof(struct bpf_zbuf_header);
|
v = pb->zbufsize - sizeof(struct bpf_zbuf_header);
|
||||||
@@ -1977,11 +2001,12 @@ pcap_activate_bpf(pcap_t *p)
|
|||||||
/*
|
/*
|
||||||
* Try to put the interface into monitor mode.
|
* Try to put the interface into monitor mode.
|
||||||
*/
|
*/
|
||||||
status = monitor_mode(p, 1);
|
retv = monitor_mode(p, 1);
|
||||||
if (status != 0) {
|
if (retv != 0) {
|
||||||
/*
|
/*
|
||||||
* We failed.
|
* We failed.
|
||||||
*/
|
*/
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* This code is derived from the Stanford/CMU enet packet filter,
|
* This code is derived from the Stanford/CMU enet packet filter,
|
||||||
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
|
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
|
||||||
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
|
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
|
||||||
* Berkeley Laboratory.
|
* Berkeley Laboratory.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -34,8 +34,6 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.50 2007-04-01 21:43:55 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. The name of the author may not be used to endorse or promote
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
* products derived from this software without specific prior written
|
* products derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
@@ -31,11 +31,7 @@
|
|||||||
* By Paolo Abeni <paolo.abeni@email.it>
|
* By Paolo Abeni <paolo.abeni@email.it>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-bt-linux.c,v 1.15 2008-07-01 07:05:54 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -77,7 +73,7 @@ struct pcap_bt {
|
|||||||
int dev_id; /* device ID of device we're bound to */
|
int dev_id; /* device ID of device we're bound to */
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
||||||
{
|
{
|
||||||
struct hci_dev_list_req *dev_list;
|
struct hci_dev_list_req *dev_list;
|
||||||
@@ -88,7 +84,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
|||||||
sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
|
sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
|
||||||
if (sock < 0)
|
if (sock < 0)
|
||||||
{
|
{
|
||||||
/* if bluetooth is not supported this this is not fatal*/
|
/* if bluetooth is not supported this this is not fatal*/
|
||||||
if (errno == EAFNOSUPPORT)
|
if (errno == EAFNOSUPPORT)
|
||||||
return 0;
|
return 0;
|
||||||
snprintf(err_str, PCAP_ERRBUF_SIZE,
|
snprintf(err_str, PCAP_ERRBUF_SIZE,
|
||||||
@@ -97,7 +93,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dev_list = malloc(HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
|
dev_list = malloc(HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
|
||||||
if (!dev_list)
|
if (!dev_list)
|
||||||
{
|
{
|
||||||
snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list",
|
snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list",
|
||||||
HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
|
HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
|
||||||
@@ -107,7 +103,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
|||||||
|
|
||||||
dev_list->dev_num = HCI_MAX_DEV;
|
dev_list->dev_num = HCI_MAX_DEV;
|
||||||
|
|
||||||
if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0)
|
if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0)
|
||||||
{
|
{
|
||||||
snprintf(err_str, PCAP_ERRBUF_SIZE,
|
snprintf(err_str, PCAP_ERRBUF_SIZE,
|
||||||
"Can't get Bluetooth device list via ioctl: %s",
|
"Can't get Bluetooth device list via ioctl: %s",
|
||||||
@@ -119,11 +115,11 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
|||||||
dev_req = dev_list->dev_req;
|
dev_req = dev_list->dev_req;
|
||||||
for (i = 0; i < dev_list->dev_num; i++, dev_req++) {
|
for (i = 0; i < dev_list->dev_num; i++, dev_req++) {
|
||||||
char dev_name[20], dev_descr[30];
|
char dev_name[20], dev_descr[30];
|
||||||
|
|
||||||
snprintf(dev_name, 20, BT_IFACE"%d", dev_req->dev_id);
|
snprintf(dev_name, 20, BT_IFACE"%d", dev_req->dev_id);
|
||||||
snprintf(dev_descr, 30, "Bluetooth adapter number %d", i);
|
snprintf(dev_descr, 30, "Bluetooth adapter number %d", i);
|
||||||
|
|
||||||
if (pcap_add_if(alldevsp, dev_name, 0,
|
if (pcap_add_if(alldevsp, dev_name, 0,
|
||||||
dev_descr, err_str) < 0)
|
dev_descr, err_str) < 0)
|
||||||
{
|
{
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@@ -197,7 +193,7 @@ bt_activate(pcap_t* handle)
|
|||||||
if (sscanf(handle->opt.source, BT_IFACE"%d", &dev_id) != 1)
|
if (sscanf(handle->opt.source, BT_IFACE"%d", &dev_id) != 1)
|
||||||
{
|
{
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
"Can't get Bluetooth device index from %s",
|
"Can't get Bluetooth device index from %s",
|
||||||
handle->opt.source);
|
handle->opt.source);
|
||||||
return PCAP_ERROR;
|
return PCAP_ERROR;
|
||||||
}
|
}
|
||||||
@@ -216,7 +212,7 @@ bt_activate(pcap_t* handle)
|
|||||||
handle->setnonblock_op = pcap_setnonblock_fd;
|
handle->setnonblock_op = pcap_setnonblock_fd;
|
||||||
handle->stats_op = bt_stats_linux;
|
handle->stats_op = bt_stats_linux;
|
||||||
handlep->dev_id = dev_id;
|
handlep->dev_id = dev_id;
|
||||||
|
|
||||||
/* Create HCI socket */
|
/* Create HCI socket */
|
||||||
handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
|
handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
|
||||||
if (handle->fd < 0) {
|
if (handle->fd < 0) {
|
||||||
@@ -246,10 +242,10 @@ bt_activate(pcap_t* handle)
|
|||||||
goto close_fail;
|
goto close_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup filter, do not call hci function to avoid dependence on
|
/* Setup filter, do not call hci function to avoid dependence on
|
||||||
* external libs */
|
* external libs */
|
||||||
memset(&flt, 0, sizeof(flt));
|
memset(&flt, 0, sizeof(flt));
|
||||||
memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask));
|
memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask));
|
||||||
memset((void *) &flt.event_mask, 0xff, sizeof(flt.event_mask));
|
memset((void *) &flt.event_mask, 0xff, sizeof(flt.event_mask));
|
||||||
if (setsockopt(handle->fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) {
|
if (setsockopt(handle->fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) {
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
@@ -313,7 +309,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us
|
|||||||
bthdr = (pcap_bluetooth_h4_header*) &handle->buffer[handle->offset];
|
bthdr = (pcap_bluetooth_h4_header*) &handle->buffer[handle->offset];
|
||||||
iv.iov_base = &handle->buffer[handle->offset+sizeof(pcap_bluetooth_h4_header)];
|
iv.iov_base = &handle->buffer[handle->offset+sizeof(pcap_bluetooth_h4_header)];
|
||||||
iv.iov_len = handle->snapshot;
|
iv.iov_len = handle->snapshot;
|
||||||
|
|
||||||
memset(&msg, 0, sizeof(msg));
|
memset(&msg, 0, sizeof(msg));
|
||||||
msg.msg_iov = &iv;
|
msg.msg_iov = &iv;
|
||||||
msg.msg_iovlen = 1;
|
msg.msg_iovlen = 1;
|
||||||
@@ -338,7 +334,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us
|
|||||||
|
|
||||||
pkth.caplen = ret;
|
pkth.caplen = ret;
|
||||||
|
|
||||||
/* get direction and timestamp*/
|
/* get direction and timestamp*/
|
||||||
cmsg = CMSG_FIRSTHDR(&msg);
|
cmsg = CMSG_FIRSTHDR(&msg);
|
||||||
int in=0;
|
int in=0;
|
||||||
while (cmsg) {
|
while (cmsg) {
|
||||||
@@ -353,7 +349,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us
|
|||||||
}
|
}
|
||||||
cmsg = CMSG_NXTHDR(&msg, cmsg);
|
cmsg = CMSG_NXTHDR(&msg, cmsg);
|
||||||
}
|
}
|
||||||
if ((in && (handle->direction == PCAP_D_OUT)) ||
|
if ((in && (handle->direction == PCAP_D_OUT)) ||
|
||||||
((!in) && (handle->direction == PCAP_D_IN)))
|
((!in) && (handle->direction == PCAP_D_IN)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -375,10 +371,10 @@ bt_inject_linux(pcap_t *handle, const void *buf, size_t size)
|
|||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on "
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on "
|
||||||
"bluetooth devices");
|
"bluetooth devices");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bt_stats_linux(pcap_t *handle, struct pcap_stat *stats)
|
bt_stats_linux(pcap_t *handle, struct pcap_stat *stats)
|
||||||
{
|
{
|
||||||
struct pcap_bt *handlep = handle->priv;
|
struct pcap_bt *handlep = handle->priv;
|
||||||
@@ -386,28 +382,28 @@ bt_stats_linux(pcap_t *handle, struct pcap_stat *stats)
|
|||||||
struct hci_dev_info dev_info;
|
struct hci_dev_info dev_info;
|
||||||
struct hci_dev_stats * s = &dev_info.stat;
|
struct hci_dev_stats * s = &dev_info.stat;
|
||||||
dev_info.dev_id = handlep->dev_id;
|
dev_info.dev_id = handlep->dev_id;
|
||||||
|
|
||||||
/* ignore eintr */
|
/* ignore eintr */
|
||||||
do {
|
do {
|
||||||
ret = ioctl(handle->fd, HCIGETDEVINFO, (void *)&dev_info);
|
ret = ioctl(handle->fd, HCIGETDEVINFO, (void *)&dev_info);
|
||||||
} while ((ret == -1) && (errno == EINTR));
|
} while ((ret == -1) && (errno == EINTR));
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
"Can't get stats via ioctl: %s", strerror(errno));
|
"Can't get stats via ioctl: %s", strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we receive both rx and tx frames, so comulate all stats */
|
/* we receive both rx and tx frames, so comulate all stats */
|
||||||
stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx +
|
stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx +
|
||||||
s->acl_tx +s->sco_tx;
|
s->acl_tx +s->sco_tx;
|
||||||
stats->ps_drop = s->err_rx + s->err_tx;
|
stats->ps_drop = s->err_rx + s->err_tx;
|
||||||
stats->ps_ifdrop = 0;
|
stats->ps_ifdrop = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bt_setdirection_linux(pcap_t *p, pcap_direction_t d)
|
bt_setdirection_linux(pcap_t *p, pcap_direction_t d)
|
||||||
{
|
{
|
||||||
p->direction = d;
|
p->direction = d;
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. The name of the author may not be used to endorse or promote
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
* products derived from this software without specific prior written
|
* products derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
@@ -29,8 +29,6 @@
|
|||||||
*
|
*
|
||||||
* Bluetooth sniffing API implementation for Linux platform
|
* Bluetooth sniffing API implementation for Linux platform
|
||||||
* By Paolo Abeni <paolo.abeni@email.it>
|
* By Paolo Abeni <paolo.abeni@email.it>
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-bt-linux.h,v 1.5 2008-04-04 19:37:45 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
242
libpcap/pcap-bt-monitor-linux.c
Normal file
242
libpcap/pcap-bt-monitor-linux.c
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Michal Labedzki for Tieto Corporation
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
|
#include <bluetooth/hci.h>
|
||||||
|
#include <bluetooth/mgmt.h>
|
||||||
|
|
||||||
|
#include "pcap/bluetooth.h"
|
||||||
|
#include "pcap-int.h"
|
||||||
|
|
||||||
|
#include "pcap-bt-monitor-linux.h"
|
||||||
|
|
||||||
|
#define BT_CONTROL_SIZE 32
|
||||||
|
#define INTERFACE_NAME "bluetooth-monitor"
|
||||||
|
|
||||||
|
int
|
||||||
|
bt_monitor_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (pcap_add_if(alldevsp, INTERFACE_NAME, 0,
|
||||||
|
"Bluetooth Linux Monitor", err_str) < 0)
|
||||||
|
{
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *user)
|
||||||
|
{
|
||||||
|
struct cmsghdr *cmsg;
|
||||||
|
struct msghdr msg;
|
||||||
|
struct iovec iv[2];
|
||||||
|
ssize_t ret;
|
||||||
|
struct pcap_pkthdr pkth;
|
||||||
|
pcap_bluetooth_linux_monitor_header *bthdr;
|
||||||
|
struct mgmt_hdr hdr;
|
||||||
|
|
||||||
|
bthdr = (pcap_bluetooth_linux_monitor_header*) &handle->buffer[handle->offset];
|
||||||
|
|
||||||
|
iv[0].iov_base = &hdr;
|
||||||
|
iv[0].iov_len = MGMT_HDR_SIZE;
|
||||||
|
iv[1].iov_base = &handle->buffer[handle->offset + sizeof(pcap_bluetooth_linux_monitor_header)];
|
||||||
|
iv[1].iov_len = handle->snapshot;
|
||||||
|
|
||||||
|
memset(&pkth.ts, 0, sizeof(pkth.ts));
|
||||||
|
memset(&msg, 0, sizeof(msg));
|
||||||
|
msg.msg_iov = iv;
|
||||||
|
msg.msg_iovlen = 2;
|
||||||
|
msg.msg_control = handle->buffer;
|
||||||
|
msg.msg_controllen = handle->offset;
|
||||||
|
|
||||||
|
do {
|
||||||
|
ret = recvmsg(handle->fd, &msg, 0);
|
||||||
|
if (handle->break_loop)
|
||||||
|
{
|
||||||
|
handle->break_loop = 0;
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
} while ((ret == -1) && (errno == EINTR));
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
"Can't receive packet: %s", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkth.caplen = ret - MGMT_HDR_SIZE + sizeof(pcap_bluetooth_linux_monitor_header);
|
||||||
|
pkth.len = pkth.caplen;
|
||||||
|
|
||||||
|
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
||||||
|
if (cmsg->cmsg_level != SOL_SOCKET) continue;
|
||||||
|
|
||||||
|
if (cmsg->cmsg_type == SCM_TIMESTAMP) {
|
||||||
|
memcpy(&pkth.ts, CMSG_DATA(cmsg), sizeof(pkth.ts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bthdr->adapter_id = htons(hdr.index);
|
||||||
|
bthdr->opcode = htons(hdr.opcode);
|
||||||
|
|
||||||
|
if (handle->fcode.bf_insns == NULL ||
|
||||||
|
bpf_filter(handle->fcode.bf_insns, &handle->buffer[handle->offset],
|
||||||
|
pkth.len, pkth.caplen)) {
|
||||||
|
callback(user, &pkth, &handle->buffer[handle->offset]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0; /* didn't pass filter */
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bt_monitor_inject(pcap_t *handle, const void *buf _U_, size_t size _U_)
|
||||||
|
{
|
||||||
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported yet");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bt_monitor_setdirection(pcap_t *p, pcap_direction_t d)
|
||||||
|
{
|
||||||
|
p->direction = d;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bt_monitor_stats(pcap_t *handle _U_, struct pcap_stat *stats)
|
||||||
|
{
|
||||||
|
stats->ps_recv = 0;
|
||||||
|
stats->ps_drop = 0;
|
||||||
|
stats->ps_ifdrop = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bt_monitor_activate(pcap_t* handle)
|
||||||
|
{
|
||||||
|
struct sockaddr_hci addr;
|
||||||
|
int err = PCAP_ERROR;
|
||||||
|
int opt;
|
||||||
|
|
||||||
|
if (handle->opt.rfmon) {
|
||||||
|
/* monitor mode doesn't apply here */
|
||||||
|
return PCAP_ERROR_RFMON_NOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle->bufsize = handle->snapshot + BT_CONTROL_SIZE + sizeof(pcap_bluetooth_linux_monitor_header);
|
||||||
|
handle->offset = BT_CONTROL_SIZE;
|
||||||
|
handle->linktype = DLT_BLUETOOTH_LINUX_MONITOR;
|
||||||
|
|
||||||
|
handle->read_op = bt_monitor_read;
|
||||||
|
handle->inject_op = bt_monitor_inject;
|
||||||
|
handle->setfilter_op = install_bpf_program; /* no kernel filtering */
|
||||||
|
handle->setdirection_op = bt_monitor_setdirection;
|
||||||
|
handle->set_datalink_op = NULL; /* can't change data link type */
|
||||||
|
handle->getnonblock_op = pcap_getnonblock_fd;
|
||||||
|
handle->setnonblock_op = pcap_setnonblock_fd;
|
||||||
|
handle->stats_op = bt_monitor_stats;
|
||||||
|
|
||||||
|
handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
|
||||||
|
if (handle->fd < 0) {
|
||||||
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
"Can't create raw socket: %s", strerror(errno));
|
||||||
|
return PCAP_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle->buffer = malloc(handle->bufsize);
|
||||||
|
if (!handle->buffer) {
|
||||||
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't allocate dump buffer: %s",
|
||||||
|
pcap_strerror(errno));
|
||||||
|
goto close_fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bind socket to the HCI device */
|
||||||
|
addr.hci_family = AF_BLUETOOTH;
|
||||||
|
addr.hci_dev = HCI_DEV_NONE;
|
||||||
|
addr.hci_channel = HCI_CHANNEL_MONITOR;
|
||||||
|
|
||||||
|
if (bind(handle->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
||||||
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
"Can't attach to interface: %s", strerror(errno));
|
||||||
|
goto close_fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
opt = 1;
|
||||||
|
if (setsockopt(handle->fd, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) {
|
||||||
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
|
"Can't enable time stamp: %s", strerror(errno));
|
||||||
|
goto close_fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle->selectable_fd = handle->fd;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
close_fail:
|
||||||
|
pcap_cleanup_live_common(handle);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
pcap_t *
|
||||||
|
bt_monitor_create(const char *device, char *ebuf, int *is_ours)
|
||||||
|
{
|
||||||
|
pcap_t *p;
|
||||||
|
const char *cp;
|
||||||
|
|
||||||
|
cp = strrchr(device, '/');
|
||||||
|
if (cp == NULL)
|
||||||
|
cp = device;
|
||||||
|
|
||||||
|
if (strcmp(cp, INTERFACE_NAME) != 0) {
|
||||||
|
*is_ours = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*is_ours = 1;
|
||||||
|
p = pcap_create_common(device, ebuf, 0);
|
||||||
|
if (p == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
p->activate_op = bt_monitor_activate;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
32
libpcap/pcap-bt-monitor-linux.h
Normal file
32
libpcap/pcap-bt-monitor-linux.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Michal Labedzki for Tieto Corporation
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior written
|
||||||
|
* permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int bt_monitor_findalldevs(pcap_if_t **alldevsp, char *err_str);
|
||||||
|
pcap_t *bt_monitor_create(const char *device, char *ebuf, int *is_ours);
|
||||||
@@ -171,7 +171,7 @@ can_activate(pcap_t* handle)
|
|||||||
|
|
||||||
/* get interface index */
|
/* get interface index */
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
|
strlcpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
|
||||||
if (ioctl(handle->fd, SIOCGIFINDEX, &ifr) < 0)
|
if (ioctl(handle->fd, SIOCGIFINDEX, &ifr) < 0)
|
||||||
{
|
{
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
@@ -243,7 +243,7 @@ can_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u
|
|||||||
}
|
}
|
||||||
} while ((pkth.caplen == -1) && (errno == EINTR));
|
} while ((pkth.caplen == -1) && (errno == EINTR));
|
||||||
|
|
||||||
if (pkth.caplen < 0)
|
if (pkth.caplen == -1)
|
||||||
{
|
{
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't receive packet %d:%s",
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't receive packet %d:%s",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
|||||||
libusb_device** devs;
|
libusb_device** devs;
|
||||||
unsigned char sernum[65];
|
unsigned char sernum[65];
|
||||||
int cnt, i;
|
int cnt, i;
|
||||||
|
|
||||||
if (libusb_init(&fdctx) != 0) {
|
if (libusb_init(&fdctx) != 0) {
|
||||||
/*
|
/*
|
||||||
* XXX - if this doesn't just mean "no USB file system mounted",
|
* XXX - if this doesn't just mean "no USB file system mounted",
|
||||||
@@ -100,7 +101,7 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
|||||||
* saying "no CANUSB devices".
|
* saying "no CANUSB devices".
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt = libusb_get_device_list(fdctx,&devs);
|
cnt = libusb_get_device_list(fdctx,&devs);
|
||||||
|
|
||||||
@@ -111,24 +112,24 @@ int canusb_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
|||||||
struct libusb_device_descriptor desc;
|
struct libusb_device_descriptor desc;
|
||||||
libusb_get_device_descriptor(devs[i],&desc);
|
libusb_get_device_descriptor(devs[i],&desc);
|
||||||
|
|
||||||
if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID))
|
if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID))
|
||||||
continue; //It is not, check next device
|
continue; //It is not, check next device
|
||||||
|
|
||||||
//It is!
|
//It is!
|
||||||
libusb_device_handle *dh = NULL;
|
libusb_device_handle *dh = NULL;
|
||||||
|
|
||||||
if ((ret = libusb_open(devs[i],&dh)) == 0)
|
if ((ret = libusb_open(devs[i],&dh)) == 0)
|
||||||
{
|
{
|
||||||
char dev_name[30];
|
char dev_name[30];
|
||||||
char dev_descr[50];
|
char dev_descr[50];
|
||||||
int n = libusb_get_string_descriptor_ascii(dh,desc.iSerialNumber,sernum,64);
|
int n = libusb_get_string_descriptor_ascii(dh,desc.iSerialNumber,sernum,64);
|
||||||
sernum[n] = 0;
|
sernum[n] = 0;
|
||||||
|
|
||||||
snprintf(dev_name, 30, CANUSB_IFACE"%s", sernum);
|
snprintf(dev_name, 30, CANUSB_IFACE"%s", sernum);
|
||||||
snprintf(dev_descr, 50, "CanUSB [%s]", sernum);
|
snprintf(dev_descr, 50, "CanUSB [%s]", sernum);
|
||||||
|
|
||||||
libusb_close(dh);
|
libusb_close(dh);
|
||||||
|
|
||||||
if (pcap_add_if(alldevsp, dev_name, 0, dev_descr, err_str) < 0)
|
if (pcap_add_if(alldevsp, dev_name, 0, dev_descr, err_str) < 0)
|
||||||
{
|
{
|
||||||
libusb_free_device_list(devs,1);
|
libusb_free_device_list(devs,1);
|
||||||
@@ -148,18 +149,18 @@ static libusb_device_handle* canusb_opendevice(struct libusb_context *ctx, char*
|
|||||||
libusb_device** devs;
|
libusb_device** devs;
|
||||||
unsigned char serial[65];
|
unsigned char serial[65];
|
||||||
int cnt,i,n;
|
int cnt,i,n;
|
||||||
|
|
||||||
cnt = libusb_get_device_list(ctx,&devs);
|
cnt = libusb_get_device_list(ctx,&devs);
|
||||||
|
|
||||||
for(i=0;i<cnt;i++)
|
for(i=0;i<cnt;i++)
|
||||||
{
|
{
|
||||||
// Check if this device is interesting.
|
// Check if this device is interesting.
|
||||||
struct libusb_device_descriptor desc;
|
struct libusb_device_descriptor desc;
|
||||||
libusb_get_device_descriptor(devs[i],&desc);
|
libusb_get_device_descriptor(devs[i],&desc);
|
||||||
|
|
||||||
if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID))
|
if ((desc.idVendor != CANUSB_VID) || (desc.idProduct != CANUSB_PID))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Found one!
|
//Found one!
|
||||||
libusb_device_handle *dh = NULL;
|
libusb_device_handle *dh = NULL;
|
||||||
|
|
||||||
@@ -191,9 +192,9 @@ static libusb_device_handle* canusb_opendevice(struct libusb_context *ctx, char*
|
|||||||
libusb_close(dh);
|
libusb_close(dh);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fount it!
|
//Fount it!
|
||||||
libusb_free_device_list(devs,1);
|
libusb_free_device_list(devs,1);
|
||||||
return dh;
|
return dh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +205,7 @@ static libusb_device_handle* canusb_opendevice(struct libusb_context *ctx, char*
|
|||||||
|
|
||||||
pcap_t *
|
pcap_t *
|
||||||
canusb_create(const char *device, char *ebuf, int *is_ours)
|
canusb_create(const char *device, char *ebuf, int *is_ours)
|
||||||
{
|
{
|
||||||
const char *cp;
|
const char *cp;
|
||||||
char *cpend;
|
char *cpend;
|
||||||
long devnum;
|
long devnum;
|
||||||
@@ -258,30 +259,31 @@ static void* canusb_capture_thread(void *arg)
|
|||||||
{
|
{
|
||||||
struct pcap_canusb *canusb = arg;
|
struct pcap_canusb *canusb = arg;
|
||||||
int i;
|
int i;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint8_t rxsz, txsz;
|
uint8_t rxsz, txsz;
|
||||||
} status;
|
} status;
|
||||||
|
|
||||||
fcntl(canusb->wrpipe, F_SETFL, O_NONBLOCK);
|
fcntl(canusb->wrpipe, F_SETFL, O_NONBLOCK);
|
||||||
|
|
||||||
while(canusb->loop)
|
while(canusb->loop)
|
||||||
{
|
{
|
||||||
int sz;
|
int sz;
|
||||||
struct CAN_Msg msg;
|
struct CAN_Msg msg;
|
||||||
|
|
||||||
|
libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
|
||||||
|
//HACK!!!!! -> drop buffered data, read new one by reading twice.
|
||||||
libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
|
libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
|
||||||
//HACK!!!!! -> drop buffered data, read new one by reading twice.
|
|
||||||
libusb_interrupt_transfer(canusb->dev, 0x81, (unsigned char*)&status, sizeof(status), &sz, 100);
|
|
||||||
|
|
||||||
for(i = 0; i<status.rxsz; i++)
|
for(i = 0; i<status.rxsz; i++)
|
||||||
{
|
{
|
||||||
libusb_bulk_transfer(canusb->dev, 0x85, (unsigned char*)&msg, sizeof(msg), &sz, 100);
|
libusb_bulk_transfer(canusb->dev, 0x85, (unsigned char*)&msg, sizeof(msg), &sz, 100);
|
||||||
write(canusb->wrpipe, &msg, sizeof(msg));
|
if(write(canusb->wrpipe, &msg, sizeof(msg)) < 0)
|
||||||
|
fprintf(stderr,"write() error: %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +297,7 @@ static int canusb_startcapture(struct pcap_canusb* this)
|
|||||||
this->rdpipe = pipefd[0];
|
this->rdpipe = pipefd[0];
|
||||||
this->wrpipe = pipefd[1];
|
this->wrpipe = pipefd[1];
|
||||||
|
|
||||||
this->loop = 1;
|
this->loop = 1;
|
||||||
pthread_create(&this->worker, NULL, canusb_capture_thread, this);
|
pthread_create(&this->worker, NULL, canusb_capture_thread, this);
|
||||||
|
|
||||||
return this->rdpipe;
|
return this->rdpipe;
|
||||||
@@ -310,7 +312,7 @@ static void canusb_clearbufs(struct pcap_canusb* this)
|
|||||||
cmd[1] = 1; //Empty outgoing buffer
|
cmd[1] = 1; //Empty outgoing buffer
|
||||||
cmd[3] = 0; //Not a write to serial number
|
cmd[3] = 0; //Not a write to serial number
|
||||||
memset(&cmd[4],0,16-4);
|
memset(&cmd[4],0,16-4);
|
||||||
|
|
||||||
libusb_interrupt_transfer(this->dev, 0x1,cmd,16,&al,100);
|
libusb_interrupt_transfer(this->dev, 0x1,cmd,16,&al,100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +328,7 @@ static void canusb_close(pcap_t* handle)
|
|||||||
{
|
{
|
||||||
libusb_close(canusb->dev);
|
libusb_close(canusb->dev);
|
||||||
canusb->dev = NULL;
|
canusb->dev = NULL;
|
||||||
}
|
}
|
||||||
if (canusb->ctx)
|
if (canusb->ctx)
|
||||||
{
|
{
|
||||||
libusb_exit(canusb->ctx);
|
libusb_exit(canusb->ctx);
|
||||||
@@ -345,9 +347,9 @@ static int canusb_activate(pcap_t* handle)
|
|||||||
/*
|
/*
|
||||||
* XXX - what causes this to fail?
|
* XXX - what causes this to fail?
|
||||||
*/
|
*/
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "libusb_init() failed");
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "libusb_init() failed");
|
||||||
return PCAP_ERROR;
|
return PCAP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->read_op = canusb_read_linux;
|
handle->read_op = canusb_read_linux;
|
||||||
|
|
||||||
@@ -371,7 +373,7 @@ static int canusb_activate(pcap_t* handle)
|
|||||||
if (!canusb->dev)
|
if (!canusb->dev)
|
||||||
{
|
{
|
||||||
libusb_exit(canusb->ctx);
|
libusb_exit(canusb->ctx);
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't open USB Device");
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't open USB Device");
|
||||||
return PCAP_ERROR;
|
return PCAP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +395,7 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
struct CAN_Msg msg;
|
struct CAN_Msg msg;
|
||||||
struct pcap_pkthdr pkth;
|
struct pcap_pkthdr pkth;
|
||||||
|
|
||||||
while(i < max_packets)
|
while(i < max_packets)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
@@ -404,10 +406,10 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char
|
|||||||
pkth.caplen = pkth.len = n;
|
pkth.caplen = pkth.len = n;
|
||||||
pkth.caplen -= 4;
|
pkth.caplen -= 4;
|
||||||
pkth.caplen -= 8 - msg.length;
|
pkth.caplen -= 8 - msg.length;
|
||||||
|
|
||||||
if ((firstpacket.tv_sec == -1) && (firstpacket.tv_usec == -1))
|
if ((firstpacket.tv_sec == -1) && (firstpacket.tv_usec == -1))
|
||||||
gettimeofday(&firstpacket, NULL);
|
gettimeofday(&firstpacket, NULL);
|
||||||
|
|
||||||
pkth.ts.tv_usec = firstpacket.tv_usec + (msg.timestamp % 100) * 10000;
|
pkth.ts.tv_usec = firstpacket.tv_usec + (msg.timestamp % 100) * 10000;
|
||||||
pkth.ts.tv_sec = firstpacket.tv_usec + (msg.timestamp / 100);
|
pkth.ts.tv_sec = firstpacket.tv_usec + (msg.timestamp / 100);
|
||||||
if (pkth.ts.tv_usec > 1000000)
|
if (pkth.ts.tv_usec > 1000000)
|
||||||
@@ -419,7 +421,7 @@ canusb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char
|
|||||||
callback(user, &pkth, (void*)&msg.id);
|
callback(user, &pkth, (void*)&msg.id);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include "pcap-int.h"
|
#include "pcap-int.h"
|
||||||
#include "pcap/usb.h"
|
#include "pcap/usb.h"
|
||||||
|
#include "pcap/nflog.h"
|
||||||
|
|
||||||
#include "pcap-common.h"
|
#include "pcap-common.h"
|
||||||
|
|
||||||
@@ -385,7 +386,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Juniper-private data link type, as per request from
|
* Juniper-private data link type, as per request from
|
||||||
* Hannes Gredler <hannes@juniper.net>.
|
* Hannes Gredler <hannes@juniper.net>.
|
||||||
* The Link Types are used for prepending meta-information
|
* The Link Types are used for prepending meta-information
|
||||||
* like interface index, interface name
|
* like interface index, interface name
|
||||||
* before standard Ethernet, PPP, Frelay & C-HDLC Frames
|
* before standard Ethernet, PPP, Frelay & C-HDLC Frames
|
||||||
@@ -402,7 +403,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Juniper-private data link type, as per request from
|
* Juniper-private data link type, as per request from
|
||||||
* Hannes Gredler <hannes@juniper.net>.
|
* Hannes Gredler <hannes@juniper.net>.
|
||||||
* The DLT_ is used for internal communication with a
|
* The DLT_ is used for internal communication with a
|
||||||
* voice Adapter Card (PIC)
|
* voice Adapter Card (PIC)
|
||||||
*/
|
*/
|
||||||
@@ -477,7 +478,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Juniper-private data link type, as per request from
|
* Juniper-private data link type, as per request from
|
||||||
* Hannes Gredler <hannes@juniper.net>.
|
* Hannes Gredler <hannes@juniper.net>.
|
||||||
* The DLT_ is used for internal communication with a
|
* The DLT_ is used for internal communication with a
|
||||||
* integrated service module (ISM).
|
* integrated service module (ISM).
|
||||||
*/
|
*/
|
||||||
@@ -518,7 +519,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Juniper-private data link type, as per request from
|
* Juniper-private data link type, as per request from
|
||||||
* Hannes Gredler <hannes@juniper.net>.
|
* Hannes Gredler <hannes@juniper.net>.
|
||||||
* The DLT_ is used for capturing data on a secure tunnel interface.
|
* The DLT_ is used for capturing data on a secure tunnel interface.
|
||||||
*/
|
*/
|
||||||
#define LINKTYPE_JUNIPER_ST 200
|
#define LINKTYPE_JUNIPER_ST 200
|
||||||
@@ -610,11 +611,11 @@
|
|||||||
*/
|
*/
|
||||||
#define LINKTYPE_IEEE802_15_4_NONASK_PHY 215
|
#define LINKTYPE_IEEE802_15_4_NONASK_PHY 215
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* David Gibson <david@gibson.dropbear.id.au> requested this for
|
* David Gibson <david@gibson.dropbear.id.au> requested this for
|
||||||
* captures from the Linux kernel /dev/input/eventN devices. This
|
* captures from the Linux kernel /dev/input/eventN devices. This
|
||||||
* is used to communicate keystrokes and mouse movements from the
|
* is used to communicate keystrokes and mouse movements from the
|
||||||
* Linux kernel to display systems, such as Xorg.
|
* Linux kernel to display systems, such as Xorg.
|
||||||
*/
|
*/
|
||||||
#define LINKTYPE_LINUX_EVDEV 216
|
#define LINKTYPE_LINUX_EVDEV 216
|
||||||
|
|
||||||
@@ -776,7 +777,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Juniper-private data link type, as per request from
|
* Juniper-private data link type, as per request from
|
||||||
* Hannes Gredler <hannes@juniper.net>.
|
* Hannes Gredler <hannes@juniper.net>.
|
||||||
*/
|
*/
|
||||||
#define LINKTYPE_JUNIPER_VS 232
|
#define LINKTYPE_JUNIPER_VS 232
|
||||||
#define LINKTYPE_JUNIPER_SRX_E2E 233
|
#define LINKTYPE_JUNIPER_SRX_E2E 233
|
||||||
@@ -808,12 +809,12 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Juniper-private data link type, as per request from
|
* Juniper-private data link type, as per request from
|
||||||
* Hannes Gredler <hannes@juniper.net>.
|
* Hannes Gredler <hannes@juniper.net>.
|
||||||
*/
|
*/
|
||||||
#define LINKTYPE_JUNIPER_ATM_CEMIC 238
|
#define LINKTYPE_JUNIPER_ATM_CEMIC 238
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NetFilter LOG messages
|
* NetFilter LOG messages
|
||||||
* (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
|
* (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
|
||||||
*
|
*
|
||||||
* Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
|
* Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl>
|
||||||
@@ -921,7 +922,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Link-layer header type for upper-protocol layer PDU saves from wireshark.
|
* Link-layer header type for upper-protocol layer PDU saves from wireshark.
|
||||||
*
|
*
|
||||||
* the actual contents are determined by two TAGs stored with each
|
* the actual contents are determined by two TAGs stored with each
|
||||||
* packet:
|
* packet:
|
||||||
* EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the
|
* EXP_PDU_TAG_LINKTYPE the link type (LINKTYPE_ value) of the
|
||||||
@@ -932,7 +933,74 @@
|
|||||||
*/
|
*/
|
||||||
#define LINKTYPE_WIRESHARK_UPPER_PDU 252
|
#define LINKTYPE_WIRESHARK_UPPER_PDU 252
|
||||||
|
|
||||||
#define LINKTYPE_MATCHING_MAX 252 /* highest value in the "matching" range */
|
/*
|
||||||
|
* Link-layer header type for the netlink protocol (nlmon devices).
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_NETLINK 253
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bluetooth Linux Monitor headers for the BlueZ stack.
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_BLUETOOTH_LINUX_MONITOR 254
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bluetooth Basic Rate/Enhanced Data Rate baseband packets, as
|
||||||
|
* captured by Ubertooth.
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_BLUETOOTH_BREDR_BB 255
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bluetooth Low Energy link layer packets, as captured by Ubertooth.
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_BLUETOOTH_LE_LL_WITH_PHDR 256
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PROFIBUS data link layer.
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_PROFIBUS_DL 257
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apple's DLT_PKTAP headers.
|
||||||
|
*
|
||||||
|
* Sadly, the folks at Apple either had no clue that the DLT_USERn values
|
||||||
|
* are for internal use within an organization and partners only, and
|
||||||
|
* didn't know that the right way to get a link-layer header type is to
|
||||||
|
* ask tcpdump.org for one, or knew and didn't care, so they just
|
||||||
|
* used DLT_USER2, which causes problems for everything except for
|
||||||
|
* their version of tcpdump.
|
||||||
|
*
|
||||||
|
* So I'll just give them one; hopefully this will show up in a
|
||||||
|
* libpcap release in time for them to get this into 10.10 Big Sur
|
||||||
|
* or whatever Mavericks' successor is called. LINKTYPE_PKTAP
|
||||||
|
* will be 258 *even on OS X*; that is *intentional*, so that
|
||||||
|
* PKTAP files look the same on *all* OSes (different OSes can have
|
||||||
|
* different numerical values for a given DLT_, but *MUST NOT* have
|
||||||
|
* different values for what goes in a file, as files can be moved
|
||||||
|
* between OSes!).
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_PKTAP 258
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ethernet packets preceded by a header giving the last 6 octets
|
||||||
|
* of the preamble specified by 802.3-2012 Clause 65, section
|
||||||
|
* 65.1.3.2 "Transmit".
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_EPON 259
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IPMI trace packets, as specified by Table 3-20 "Trace Data Block Format"
|
||||||
|
* in the PICMG HPM.2 specification.
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_IPMI_HPM_2 260
|
||||||
|
|
||||||
|
/*
|
||||||
|
* per Joshua Wright <jwright@hasborg.com>, formats for Zwave captures.
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_ZWAVE_R1_R2 261
|
||||||
|
#define LINKTYPE_ZWAVE_R3 262
|
||||||
|
|
||||||
|
#define LINKTYPE_MATCHING_MAX 262 /* highest value in the "matching" range */
|
||||||
|
|
||||||
static struct linktype_map {
|
static struct linktype_map {
|
||||||
int dlt;
|
int dlt;
|
||||||
@@ -1005,13 +1073,20 @@ dlt_to_linktype(int dlt)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map DLT_PFSYNC, whatever it might be, to LINKTYPE_PFSYNC.
|
* DLTs that, on some platforms, have values in the matching range
|
||||||
|
* but that *don't* have the same value as the corresponding
|
||||||
|
* LINKTYPE because, for some reason, not all OSes have the
|
||||||
|
* same value for that DLT (note that the DLT's value might be
|
||||||
|
* outside the matching range on some of those OSes).
|
||||||
*/
|
*/
|
||||||
if (dlt == DLT_PFSYNC)
|
if (dlt == DLT_PFSYNC)
|
||||||
return (LINKTYPE_PFSYNC);
|
return (LINKTYPE_PFSYNC);
|
||||||
|
if (dlt == DLT_PKTAP)
|
||||||
|
return (LINKTYPE_PKTAP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map the values in the matching range.
|
* For all other values in the matching range, the DLT
|
||||||
|
* value is the same as the LINKTYPE value.
|
||||||
*/
|
*/
|
||||||
if (dlt >= DLT_MATCHING_MIN && dlt <= DLT_MATCHING_MAX)
|
if (dlt >= DLT_MATCHING_MIN && dlt <= DLT_MATCHING_MAX)
|
||||||
return (dlt);
|
return (dlt);
|
||||||
@@ -1025,9 +1100,9 @@ dlt_to_linktype(int dlt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we don't have a mapping for this DLT_ code, return an
|
* If we don't have a mapping for this DLT, return an
|
||||||
* error; that means that this is a value with no corresponding
|
* error; that means that this is a value with no corresponding
|
||||||
* LINKTYPE_ code, and we need to assign one.
|
* LINKTYPE, and we need to assign one.
|
||||||
*/
|
*/
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@@ -1038,16 +1113,19 @@ linktype_to_dlt(int linktype)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map LINKTYPE_PFSYNC to DLT_PFSYNC, whatever it might be.
|
* LINKTYPEs in the matching range that *don't*
|
||||||
* LINKTYPE_PFSYNC is in the matching range, to make sure
|
* have the same value as the corresponding DLTs
|
||||||
* it's as safe from reuse as we can arrange, so we do
|
* because, for some reason, not all OSes have the
|
||||||
* this test first.
|
* same value for that DLT.
|
||||||
*/
|
*/
|
||||||
if (linktype == LINKTYPE_PFSYNC)
|
if (linktype == LINKTYPE_PFSYNC)
|
||||||
return (DLT_PFSYNC);
|
return (DLT_PFSYNC);
|
||||||
|
if (linktype == LINKTYPE_PKTAP)
|
||||||
|
return (DLT_PKTAP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map the values in the matching range.
|
* For all other values in the matching range, the LINKTYPE
|
||||||
|
* value is the same as the DLT value.
|
||||||
*/
|
*/
|
||||||
if (linktype >= LINKTYPE_MATCHING_MIN &&
|
if (linktype >= LINKTYPE_MATCHING_MIN &&
|
||||||
linktype <= LINKTYPE_MATCHING_MAX)
|
linktype <= LINKTYPE_MATCHING_MAX)
|
||||||
@@ -1062,9 +1140,9 @@ linktype_to_dlt(int linktype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we don't have an entry for this link type, return
|
* If we don't have an entry for this LINKTYPE, return
|
||||||
* the link type value; it may be a DLT_ value from an
|
* the link type value; it may be a DLT from an older
|
||||||
* older version of libpcap.
|
* version of libpcap.
|
||||||
*/
|
*/
|
||||||
return linktype;
|
return linktype;
|
||||||
}
|
}
|
||||||
@@ -1075,17 +1153,15 @@ linktype_to_dlt(int linktype)
|
|||||||
* memory-mapped buffer shared by the kernel).
|
* memory-mapped buffer shared by the kernel).
|
||||||
*
|
*
|
||||||
* When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED capture file,
|
* When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED capture file,
|
||||||
* we need to convert it from the capturing host's byte order to
|
* we need to convert it from the byte order of the host that wrote
|
||||||
* the reading host's byte order.
|
* the file to this host's byte order.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
|
swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
|
||||||
int header_len_64_bytes)
|
int header_len_64_bytes)
|
||||||
{
|
{
|
||||||
pcap_usb_header_mmapped *uhdr = (pcap_usb_header_mmapped *)buf;
|
pcap_usb_header_mmapped *uhdr = (pcap_usb_header_mmapped *)buf;
|
||||||
bpf_u_int32 offset = 0;
|
bpf_u_int32 offset = 0;
|
||||||
usb_isodesc *pisodesc;
|
|
||||||
int32_t numdesc, i;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "offset" is the offset *past* the field we're swapping;
|
* "offset" is the offset *past* the field we're swapping;
|
||||||
@@ -1094,7 +1170,7 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The URB id is a totally opaque value; do we really need to
|
* The URB id is a totally opaque value; do we really need to
|
||||||
* convert it to the reading host's byte order???
|
* convert it to the reading host's byte order???
|
||||||
*/
|
*/
|
||||||
offset += 8; /* skip past id */
|
offset += 8; /* skip past id */
|
||||||
@@ -1149,6 +1225,17 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
|
|||||||
} else
|
} else
|
||||||
offset += 8; /* skip USB setup header */
|
offset += 8; /* skip USB setup header */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* With the old header, there are no isochronous descriptors
|
||||||
|
* after the header.
|
||||||
|
*
|
||||||
|
* With the new header, the actual number of descriptors in
|
||||||
|
* the header is not s.iso.numdesc, it's ndesc - only the
|
||||||
|
* first N descriptors, for some value of N, are put into
|
||||||
|
* the header, and ndesc is set to the actual number copied.
|
||||||
|
* In addition, if s.iso.numdesc is negative, no descriptors
|
||||||
|
* are captured, and ndesc is set to 0.
|
||||||
|
*/
|
||||||
if (header_len_64_bytes) {
|
if (header_len_64_bytes) {
|
||||||
/*
|
/*
|
||||||
* This is either the "version 1" header, with
|
* This is either the "version 1" header, with
|
||||||
@@ -1177,31 +1264,123 @@ swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
|
|||||||
if (hdr->caplen < offset)
|
if (hdr->caplen < offset)
|
||||||
return;
|
return;
|
||||||
uhdr->ndesc = SWAPLONG(uhdr->ndesc);
|
uhdr->ndesc = SWAPLONG(uhdr->ndesc);
|
||||||
}
|
|
||||||
|
|
||||||
if (uhdr->transfer_type == URB_ISOCHRONOUS) {
|
if (uhdr->transfer_type == URB_ISOCHRONOUS) {
|
||||||
/* swap the values in struct linux_usb_isodesc */
|
/* swap the values in struct linux_usb_isodesc */
|
||||||
pisodesc = (usb_isodesc *)(void *)(buf+offset);
|
usb_isodesc *pisodesc;
|
||||||
numdesc = uhdr->s.iso.numdesc;
|
u_int32_t i;
|
||||||
for (i = 0; i < numdesc; i++) {
|
|
||||||
offset += 4; /* skip past status */
|
|
||||||
if (hdr->caplen < offset)
|
|
||||||
return;
|
|
||||||
pisodesc->status = SWAPLONG(pisodesc->status);
|
|
||||||
|
|
||||||
offset += 4; /* skip past offset */
|
pisodesc = (usb_isodesc *)(void *)(buf+offset);
|
||||||
if (hdr->caplen < offset)
|
for (i = 0; i < uhdr->ndesc; i++) {
|
||||||
return;
|
offset += 4; /* skip past status */
|
||||||
pisodesc->offset = SWAPLONG(pisodesc->offset);
|
if (hdr->caplen < offset)
|
||||||
|
return;
|
||||||
|
pisodesc->status = SWAPLONG(pisodesc->status);
|
||||||
|
|
||||||
offset += 4; /* skip past len */
|
offset += 4; /* skip past offset */
|
||||||
if (hdr->caplen < offset)
|
if (hdr->caplen < offset)
|
||||||
return;
|
return;
|
||||||
pisodesc->len = SWAPLONG(pisodesc->len);
|
pisodesc->offset = SWAPLONG(pisodesc->offset);
|
||||||
|
|
||||||
offset += 4; /* skip past padding */
|
offset += 4; /* skip past len */
|
||||||
|
if (hdr->caplen < offset)
|
||||||
|
return;
|
||||||
|
pisodesc->len = SWAPLONG(pisodesc->len);
|
||||||
|
|
||||||
pisodesc++;
|
offset += 4; /* skip past padding */
|
||||||
|
|
||||||
|
pisodesc++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The DLT_NFLOG "packets" have a mixture of big-endian and host-byte-order
|
||||||
|
* data. They begin with a fixed-length header with big-endian fields,
|
||||||
|
* followed by a set of TLVs, where the type and length are in host
|
||||||
|
* byte order but the values are either big-endian or are a raw byte
|
||||||
|
* sequence that's the same regardless of the host's byte order.
|
||||||
|
*
|
||||||
|
* When reading a DLT_NFLOG capture file, we need to convert the type
|
||||||
|
* and length values from the byte order of the host that wrote the
|
||||||
|
* file to the byte order of this host.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
swap_nflog_header(const struct pcap_pkthdr *hdr, u_char *buf)
|
||||||
|
{
|
||||||
|
u_char *p = buf;
|
||||||
|
nflog_hdr_t *nfhdr = (nflog_hdr_t *)buf;
|
||||||
|
nflog_tlv_t *tlv;
|
||||||
|
u_int caplen = hdr->caplen;
|
||||||
|
u_int length = hdr->len;
|
||||||
|
u_int16_t size;
|
||||||
|
|
||||||
|
if (caplen < (int) sizeof(nflog_hdr_t) || length < (int) sizeof(nflog_hdr_t)) {
|
||||||
|
/* Not enough data to have any TLVs. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(nfhdr->nflog_version) == 0) {
|
||||||
|
/* Unknown NFLOG version */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
length -= sizeof(nflog_hdr_t);
|
||||||
|
caplen -= sizeof(nflog_hdr_t);
|
||||||
|
p += sizeof(nflog_hdr_t);
|
||||||
|
|
||||||
|
while (caplen >= sizeof(nflog_tlv_t)) {
|
||||||
|
tlv = (nflog_tlv_t *) p;
|
||||||
|
|
||||||
|
/* Swap the type and length. */
|
||||||
|
tlv->tlv_type = SWAPSHORT(tlv->tlv_type);
|
||||||
|
tlv->tlv_length = SWAPSHORT(tlv->tlv_length);
|
||||||
|
|
||||||
|
/* Get the length of the TLV. */
|
||||||
|
size = tlv->tlv_length;
|
||||||
|
if (size % 4 != 0)
|
||||||
|
size += 4 - size % 4;
|
||||||
|
|
||||||
|
/* Is the TLV's length less than the minimum? */
|
||||||
|
if (size < sizeof(nflog_tlv_t)) {
|
||||||
|
/* Yes. Give up now. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do we have enough data for the full TLV? */
|
||||||
|
if (caplen < size || length < size) {
|
||||||
|
/* No. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Skip over the TLV. */
|
||||||
|
length -= size;
|
||||||
|
caplen -= size;
|
||||||
|
p += size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr, u_char *data)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Convert pseudo-headers from the byte order of
|
||||||
|
* the host on which the file was saved to our
|
||||||
|
* byte order, as necessary.
|
||||||
|
*/
|
||||||
|
switch (linktype) {
|
||||||
|
|
||||||
|
case DLT_USB_LINUX:
|
||||||
|
swap_linux_usb_header(hdr, data, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DLT_USB_LINUX_MMAPPED:
|
||||||
|
swap_linux_usb_header(hdr, data, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DLT_NFLOG:
|
||||||
|
swap_nflog_header(hdr, data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ extern int dlt_to_linktype(int dlt);
|
|||||||
|
|
||||||
extern int linktype_to_dlt(int linktype);
|
extern int linktype_to_dlt(int linktype);
|
||||||
|
|
||||||
extern void swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
|
extern void swap_pseudo_headers(int linktype, struct pcap_pkthdr *hdr,
|
||||||
int header_len_64_bytes);
|
u_char *data);
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
.\" @(#) $Header: /tcpdump/master/libpcap/pcap-config.1,v 1.1 2008-09-23 18:04:01 guy Exp $ (LBL)
|
|
||||||
.\"
|
|
||||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@@ -20,7 +18,7 @@
|
|||||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
.\"
|
.\"
|
||||||
.TH PCAP-CONFIG 1 "26 March 2009"
|
.TH PCAP-CONFIG 1 "22 May 2009"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
pcap-config \- write libpcap compiler and linker flags to standard output
|
pcap-config \- write libpcap compiler and linker flags to standard output
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* pcap-dag.c: Packet capture interface for Endace DAG card.
|
* pcap-dag.c: Packet capture interface for Emulex EndaceDAG cards.
|
||||||
*
|
*
|
||||||
* The functionality of this code attempts to mimic that of pcap-linux as much
|
* The functionality of this code attempts to mimic that of pcap-linux as much
|
||||||
* as possible. This code is compiled in several different ways depending on
|
* as possible. This code is compiled in several different ways depending on
|
||||||
@@ -10,16 +10,11 @@
|
|||||||
* called as required from their pcap-linux/bpf equivalents.
|
* called as required from their pcap-linux/bpf equivalents.
|
||||||
*
|
*
|
||||||
* Authors: Richard Littin, Sean Irvine ({richard,sean}@reeltwo.com)
|
* Authors: Richard Littin, Sean Irvine ({richard,sean}@reeltwo.com)
|
||||||
* Modifications: Jesper Peterson <support@endace.com>
|
* Modifications: Jesper Peterson
|
||||||
* Koryn Grant <support@endace.com>
|
* Koryn Grant
|
||||||
* Stephen Donnelly <support@endace.com>
|
* Stephen Donnelly <stephen.donnelly@emulex.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.39 2008-04-14 20:40:58 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -45,6 +40,7 @@ struct rtentry; /* declarations in <net/if.h> */
|
|||||||
|
|
||||||
#include "dagnew.h"
|
#include "dagnew.h"
|
||||||
#include "dagapi.h"
|
#include "dagapi.h"
|
||||||
|
#include "dagpci.h"
|
||||||
|
|
||||||
#include "pcap-dag.h"
|
#include "pcap-dag.h"
|
||||||
|
|
||||||
@@ -155,7 +151,7 @@ dag_platform_cleanup(pcap_t *p)
|
|||||||
#ifdef HAVE_DAG_STREAMS_API
|
#ifdef HAVE_DAG_STREAMS_API
|
||||||
if(dag_stop_stream(p->fd, pd->dag_stream) < 0)
|
if(dag_stop_stream(p->fd, pd->dag_stream) < 0)
|
||||||
fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));
|
fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));
|
||||||
|
|
||||||
if(dag_detach_stream(p->fd, pd->dag_stream) < 0)
|
if(dag_detach_stream(p->fd, pd->dag_stream) < 0)
|
||||||
fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
|
fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
|
||||||
#else
|
#else
|
||||||
@@ -226,7 +222,7 @@ dag_erf_ext_header_count(uint8_t * erf, size_t len)
|
|||||||
|
|
||||||
/* loop over the extension headers */
|
/* loop over the extension headers */
|
||||||
do {
|
do {
|
||||||
|
|
||||||
/* sanity check we have enough bytes */
|
/* sanity check we have enough bytes */
|
||||||
if ( len < (24 + (hdr_num * 8)) )
|
if ( len < (24 + (hdr_num * 8)) )
|
||||||
return hdr_num;
|
return hdr_num;
|
||||||
@@ -253,10 +249,11 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
int flags = pd->dag_offset_flags;
|
int flags = pd->dag_offset_flags;
|
||||||
unsigned int nonblocking = flags & DAGF_NONBLOCK;
|
unsigned int nonblocking = flags & DAGF_NONBLOCK;
|
||||||
unsigned int num_ext_hdr = 0;
|
unsigned int num_ext_hdr = 0;
|
||||||
|
unsigned int ticks_per_second;
|
||||||
|
|
||||||
/* Get the next bufferful of packets (if necessary). */
|
/* Get the next bufferful of packets (if necessary). */
|
||||||
while (pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size) {
|
while (pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Has "pcap_breakloop()" been called?
|
* Has "pcap_breakloop()" been called?
|
||||||
*/
|
*/
|
||||||
@@ -295,7 +292,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
/* Pcap is configured to process only available packets, and there aren't any, return immediately. */
|
/* Pcap is configured to process only available packets, and there aren't any, return immediately. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!nonblocking &&
|
if(!nonblocking &&
|
||||||
pd->dag_timeout &&
|
pd->dag_timeout &&
|
||||||
(pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size))
|
(pd->dag_mem_top - pd->dag_mem_bottom < dag_record_size))
|
||||||
@@ -305,14 +302,14 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process the packets. */
|
/* Process the packets. */
|
||||||
while (pd->dag_mem_top - pd->dag_mem_bottom >= dag_record_size) {
|
while (pd->dag_mem_top - pd->dag_mem_bottom >= dag_record_size) {
|
||||||
|
|
||||||
unsigned short packet_len = 0;
|
unsigned short packet_len = 0;
|
||||||
int caplen = 0;
|
int caplen = 0;
|
||||||
struct pcap_pkthdr pcap_header;
|
struct pcap_pkthdr pcap_header;
|
||||||
|
|
||||||
#ifdef HAVE_DAG_STREAMS_API
|
#ifdef HAVE_DAG_STREAMS_API
|
||||||
dag_record_t *header = (dag_record_t *)(pd->dag_mem_bottom);
|
dag_record_t *header = (dag_record_t *)(pd->dag_mem_bottom);
|
||||||
#else
|
#else
|
||||||
@@ -321,7 +318,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
|
|
||||||
u_char *dp = ((u_char *)header); /* + dag_record_size; */
|
u_char *dp = ((u_char *)header); /* + dag_record_size; */
|
||||||
unsigned short rlen;
|
unsigned short rlen;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Has "pcap_breakloop()" been called?
|
* Has "pcap_breakloop()" been called?
|
||||||
*/
|
*/
|
||||||
@@ -334,7 +331,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
p->break_loop = 0;
|
p->break_loop = 0;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
rlen = ntohs(header->rlen);
|
rlen = ntohs(header->rlen);
|
||||||
if (rlen < dag_record_size)
|
if (rlen < dag_record_size)
|
||||||
{
|
{
|
||||||
@@ -364,7 +361,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((header->type & 0x7f) == TYPE_PAD) {
|
if ((header->type & 0x7f) == TYPE_PAD) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -372,13 +369,13 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
num_ext_hdr = dag_erf_ext_header_count(dp, rlen);
|
num_ext_hdr = dag_erf_ext_header_count(dp, rlen);
|
||||||
|
|
||||||
/* ERF encapsulation */
|
/* ERF encapsulation */
|
||||||
/* The Extensible Record Format is not dropped for this kind of encapsulation,
|
/* The Extensible Record Format is not dropped for this kind of encapsulation,
|
||||||
* and will be handled as a pseudo header by the decoding application.
|
* and will be handled as a pseudo header by the decoding application.
|
||||||
* The information carried in the ERF header and in the optional subheader (if present)
|
* The information carried in the ERF header and in the optional subheader (if present)
|
||||||
* could be merged with the libpcap information, to offer a better decoding.
|
* could be merged with the libpcap information, to offer a better decoding.
|
||||||
* The packet length is
|
* The packet length is
|
||||||
* o the length of the packet on the link (header->wlen),
|
* o the length of the packet on the link (header->wlen),
|
||||||
* o plus the length of the ERF header (dag_record_size), as the length of the
|
* o plus the length of the ERF header (dag_record_size), as the length of the
|
||||||
* pseudo header will be adjusted during the decoding,
|
* pseudo header will be adjusted during the decoding,
|
||||||
* o plus the length of the optional subheader (if present).
|
* o plus the length of the optional subheader (if present).
|
||||||
*
|
*
|
||||||
@@ -420,7 +417,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
dp += dag_record_size;
|
dp += dag_record_size;
|
||||||
/* Skip over extension headers */
|
/* Skip over extension headers */
|
||||||
dp += 8 * num_ext_hdr;
|
dp += 8 * num_ext_hdr;
|
||||||
|
|
||||||
switch((header->type & 0x7f)) {
|
switch((header->type & 0x7f)) {
|
||||||
case TYPE_ATM:
|
case TYPE_ATM:
|
||||||
case TYPE_AAL5:
|
case TYPE_AAL5:
|
||||||
@@ -439,19 +436,22 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
caplen = rlen - dag_record_size - 4;
|
caplen = rlen - dag_record_size - 4;
|
||||||
dp+=4;
|
dp+=4;
|
||||||
}
|
}
|
||||||
|
/* Skip over extension headers */
|
||||||
|
caplen -= (8 * num_ext_hdr);
|
||||||
|
|
||||||
if (header->type == TYPE_ATM) {
|
if (header->type == TYPE_ATM) {
|
||||||
caplen = packet_len = ATM_CELL_SIZE;
|
caplen = packet_len = ATM_CELL_SIZE;
|
||||||
}
|
}
|
||||||
if (p->linktype == DLT_SUNATM) {
|
if (p->linktype == DLT_SUNATM) {
|
||||||
struct sunatm_hdr *sunatm = (struct sunatm_hdr *)dp;
|
struct sunatm_hdr *sunatm = (struct sunatm_hdr *)dp;
|
||||||
unsigned long rawatm;
|
unsigned long rawatm;
|
||||||
|
|
||||||
rawatm = ntohl(*((unsigned long *)dp));
|
rawatm = ntohl(*((unsigned long *)dp));
|
||||||
sunatm->vci = htons((rawatm >> 4) & 0xffff);
|
sunatm->vci = htons((rawatm >> 4) & 0xffff);
|
||||||
sunatm->vpi = (rawatm >> 20) & 0x00ff;
|
sunatm->vpi = (rawatm >> 20) & 0x00ff;
|
||||||
sunatm->flags = ((header->flags.iface & 1) ? 0x80 : 0x00) |
|
sunatm->flags = ((header->flags.iface & 1) ? 0x80 : 0x00) |
|
||||||
((sunatm->vpi == 0 && sunatm->vci == htons(5)) ? 6 :
|
((sunatm->vpi == 0 && sunatm->vci == htons(5)) ? 6 :
|
||||||
((sunatm->vpi == 0 && sunatm->vci == htons(16)) ? 5 :
|
((sunatm->vpi == 0 && sunatm->vci == htons(16)) ? 5 :
|
||||||
((dp[ATM_HDR_SIZE] == 0xaa &&
|
((dp[ATM_HDR_SIZE] == 0xaa &&
|
||||||
dp[ATM_HDR_SIZE+1] == 0xaa &&
|
dp[ATM_HDR_SIZE+1] == 0xaa &&
|
||||||
dp[ATM_HDR_SIZE+2] == 0x03) ? 2 : 1)));
|
dp[ATM_HDR_SIZE+2] == 0x03) ? 2 : 1)));
|
||||||
@@ -470,6 +470,8 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
packet_len -= (pd->dag_fcs_bits >> 3);
|
packet_len -= (pd->dag_fcs_bits >> 3);
|
||||||
caplen = rlen - dag_record_size - 2;
|
caplen = rlen - dag_record_size - 2;
|
||||||
|
/* Skip over extension headers */
|
||||||
|
caplen -= (8 * num_ext_hdr);
|
||||||
if (caplen > packet_len) {
|
if (caplen > packet_len) {
|
||||||
caplen = packet_len;
|
caplen = packet_len;
|
||||||
}
|
}
|
||||||
@@ -483,6 +485,8 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
packet_len -= (pd->dag_fcs_bits >> 3);
|
packet_len -= (pd->dag_fcs_bits >> 3);
|
||||||
caplen = rlen - dag_record_size;
|
caplen = rlen - dag_record_size;
|
||||||
|
/* Skip over extension headers */
|
||||||
|
caplen -= (8 * num_ext_hdr);
|
||||||
if (caplen > packet_len) {
|
if (caplen > packet_len) {
|
||||||
caplen = packet_len;
|
caplen = packet_len;
|
||||||
}
|
}
|
||||||
@@ -493,6 +497,8 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
packet_len -= (pd->dag_fcs_bits >> 3);
|
packet_len -= (pd->dag_fcs_bits >> 3);
|
||||||
caplen = rlen - dag_record_size - 4;
|
caplen = rlen - dag_record_size - 4;
|
||||||
|
/* Skip over extension headers */
|
||||||
|
caplen -= (8 * num_ext_hdr);
|
||||||
if (caplen > packet_len) {
|
if (caplen > packet_len) {
|
||||||
caplen = packet_len;
|
caplen = packet_len;
|
||||||
}
|
}
|
||||||
@@ -503,7 +509,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
/* Add the MTP2 Pseudo Header */
|
/* Add the MTP2 Pseudo Header */
|
||||||
caplen += MTP2_HDR_LEN;
|
caplen += MTP2_HDR_LEN;
|
||||||
packet_len += MTP2_HDR_LEN;
|
packet_len += MTP2_HDR_LEN;
|
||||||
|
|
||||||
TempPkt[MTP2_SENT_OFFSET] = 0;
|
TempPkt[MTP2_SENT_OFFSET] = 0;
|
||||||
TempPkt[MTP2_ANNEX_A_USED_OFFSET] = MTP2_ANNEX_A_USED_UNKNOWN;
|
TempPkt[MTP2_ANNEX_A_USED_OFFSET] = MTP2_ANNEX_A_USED_UNKNOWN;
|
||||||
*(TempPkt+MTP2_LINK_NUMBER_OFFSET) = ((header->rec.mc_hdlc.mc_header>>16)&0x01);
|
*(TempPkt+MTP2_LINK_NUMBER_OFFSET) = ((header->rec.mc_hdlc.mc_header>>16)&0x01);
|
||||||
@@ -518,6 +524,8 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
case TYPE_IPV6:
|
case TYPE_IPV6:
|
||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
caplen = rlen - dag_record_size;
|
caplen = rlen - dag_record_size;
|
||||||
|
/* Skip over extension headers */
|
||||||
|
caplen -= (8 * num_ext_hdr);
|
||||||
if (caplen > packet_len) {
|
if (caplen > packet_len) {
|
||||||
caplen = packet_len;
|
caplen = packet_len;
|
||||||
}
|
}
|
||||||
@@ -538,45 +546,52 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
|||||||
continue;
|
continue;
|
||||||
} /* switch type */
|
} /* switch type */
|
||||||
|
|
||||||
/* Skip over extension headers */
|
|
||||||
caplen -= (8 * num_ext_hdr);
|
|
||||||
|
|
||||||
} /* ERF encapsulation */
|
} /* ERF encapsulation */
|
||||||
|
|
||||||
if (caplen > p->snapshot)
|
if (caplen > p->snapshot)
|
||||||
caplen = p->snapshot;
|
caplen = p->snapshot;
|
||||||
|
|
||||||
/* Run the packet filter if there is one. */
|
/* Run the packet filter if there is one. */
|
||||||
if ((p->fcode.bf_insns == NULL) || bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen)) {
|
if ((p->fcode.bf_insns == NULL) || bpf_filter(p->fcode.bf_insns, dp, packet_len, caplen)) {
|
||||||
|
|
||||||
/* convert between timestamp formats */
|
/* convert between timestamp formats */
|
||||||
register unsigned long long ts;
|
register unsigned long long ts;
|
||||||
|
|
||||||
if (IS_BIGENDIAN()) {
|
if (IS_BIGENDIAN()) {
|
||||||
ts = SWAPLL(header->ts);
|
ts = SWAPLL(header->ts);
|
||||||
} else {
|
} else {
|
||||||
ts = header->ts;
|
ts = header->ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (p->opt.tstamp_precision) {
|
||||||
|
case PCAP_TSTAMP_PRECISION_NANO:
|
||||||
|
ticks_per_second = 1000000000;
|
||||||
|
break;
|
||||||
|
case PCAP_TSTAMP_PRECISION_MICRO:
|
||||||
|
default:
|
||||||
|
ticks_per_second = 1000000;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
pcap_header.ts.tv_sec = ts >> 32;
|
pcap_header.ts.tv_sec = ts >> 32;
|
||||||
ts = (ts & 0xffffffffULL) * 1000000;
|
ts = (ts & 0xffffffffULL) * ticks_per_second;
|
||||||
ts += 0x80000000; /* rounding */
|
ts += 0x80000000; /* rounding */
|
||||||
pcap_header.ts.tv_usec = ts >> 32;
|
pcap_header.ts.tv_usec = ts >> 32;
|
||||||
if (pcap_header.ts.tv_usec >= 1000000) {
|
if (pcap_header.ts.tv_usec >= ticks_per_second) {
|
||||||
pcap_header.ts.tv_usec -= 1000000;
|
pcap_header.ts.tv_usec -= ticks_per_second;
|
||||||
pcap_header.ts.tv_sec++;
|
pcap_header.ts.tv_sec++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in our own header data */
|
/* Fill in our own header data */
|
||||||
pcap_header.caplen = caplen;
|
pcap_header.caplen = caplen;
|
||||||
pcap_header.len = packet_len;
|
pcap_header.len = packet_len;
|
||||||
|
|
||||||
/* Count the packet. */
|
/* Count the packet. */
|
||||||
pd->stat.ps_recv++;
|
pd->stat.ps_recv++;
|
||||||
|
|
||||||
/* Call the user supplied callback function */
|
/* Call the user supplied callback function */
|
||||||
callback(user, &pcap_header, dp);
|
callback(user, &pcap_header, dp);
|
||||||
|
|
||||||
/* Only count packets that pass the filter, for consistency with standard Linux behaviour. */
|
/* Only count packets that pass the filter, for consistency with standard Linux behaviour. */
|
||||||
processed++;
|
processed++;
|
||||||
if (processed == cnt && !PACKET_COUNT_IS_UNLIMITED(cnt))
|
if (processed == cnt && !PACKET_COUNT_IS_UNLIMITED(cnt))
|
||||||
@@ -603,7 +618,7 @@ dag_inject(pcap_t *p, const void *buf _U_, size_t size _U_)
|
|||||||
* device will result in a failure. The promisc flag is ignored because DAG
|
* device will result in a failure. The promisc flag is ignored because DAG
|
||||||
* cards are always promiscuous. The to_ms parameter is used in setting the
|
* cards are always promiscuous. The to_ms parameter is used in setting the
|
||||||
* API polling parameters.
|
* API polling parameters.
|
||||||
*
|
*
|
||||||
* snaplen is now also ignored, until we get per-stream slen support. Set
|
* snaplen is now also ignored, until we get per-stream slen support. Set
|
||||||
* slen with approprite DAG tool BEFORE pcap_activate().
|
* slen with approprite DAG tool BEFORE pcap_activate().
|
||||||
*
|
*
|
||||||
@@ -639,7 +654,7 @@ static int dag_activate(pcap_t* handle)
|
|||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't allocate string for device name: %s\n", pcap_strerror(errno));
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't allocate string for device name: %s\n", pcap_strerror(errno));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse input name to get dag device and stream number if provided */
|
/* Parse input name to get dag device and stream number if provided */
|
||||||
if (dag_parse_name(device, newDev, strlen(device) + 16, &handlep->dag_stream) < 0) {
|
if (dag_parse_name(device, newDev, strlen(device) + 16, &handlep->dag_stream) < 0) {
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_parse_name: %s\n", pcap_strerror(errno));
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_parse_name: %s\n", pcap_strerror(errno));
|
||||||
@@ -685,7 +700,7 @@ static int dag_activate(pcap_t* handle)
|
|||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno));
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno));
|
||||||
goto faildetach;
|
goto faildetach;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->opt.immediate) {
|
if (handle->opt.immediate) {
|
||||||
/* Call callback immediately.
|
/* Call callback immediately.
|
||||||
* XXX - is this the right way to handle this?
|
* XXX - is this the right way to handle this?
|
||||||
@@ -710,7 +725,7 @@ static int dag_activate(pcap_t* handle)
|
|||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno));
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno));
|
||||||
goto faildetach;
|
goto faildetach;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if((handlep->dag_mem_base = dag_mmap(handle->fd)) == MAP_FAILED) {
|
if((handlep->dag_mem_base = dag_mmap(handle->fd)) == MAP_FAILED) {
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_mmap %s: %s\n", device, pcap_strerror(errno));
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_mmap %s: %s\n", device, pcap_strerror(errno));
|
||||||
@@ -733,14 +748,14 @@ static int dag_activate(pcap_t* handle)
|
|||||||
handle->snapshot = MIN_DAG_SNAPLEN;
|
handle->snapshot = MIN_DAG_SNAPLEN;
|
||||||
}
|
}
|
||||||
/* snap len has to be a multiple of 4 */
|
/* snap len has to be a multiple of 4 */
|
||||||
snprintf(conf, 30, "varlen slen=%d", (snaplen + 3) & ~3);
|
snprintf(conf, 30, "varlen slen=%d", (snaplen + 3) & ~3);
|
||||||
|
|
||||||
if(dag_configure(handle->fd, conf) < 0) {
|
if(dag_configure(handle->fd, conf) < 0) {
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_configure %s: %s\n", device, pcap_strerror(errno));
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,"dag_configure %s: %s\n", device, pcap_strerror(errno));
|
||||||
goto faildetach;
|
goto faildetach;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DAG_STREAMS_API
|
#ifdef HAVE_DAG_STREAMS_API
|
||||||
if(dag_start_stream(handle->fd, handlep->dag_stream) < 0) {
|
if(dag_start_stream(handle->fd, handlep->dag_stream) < 0) {
|
||||||
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_start_stream %s: %s\n", device, pcap_strerror(errno));
|
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dag_start_stream %s: %s\n", device, pcap_strerror(errno));
|
||||||
@@ -807,7 +822,7 @@ static int dag_activate(pcap_t* handle)
|
|||||||
handle->linktype = -1;
|
handle->linktype = -1;
|
||||||
if (dag_get_datalink(handle) < 0)
|
if (dag_get_datalink(handle) < 0)
|
||||||
goto failstop;
|
goto failstop;
|
||||||
|
|
||||||
handle->bufsize = 0;
|
handle->bufsize = 0;
|
||||||
|
|
||||||
if (new_pcap_dag(handle) < 0) {
|
if (new_pcap_dag(handle) < 0) {
|
||||||
@@ -838,12 +853,12 @@ static int dag_activate(pcap_t* handle)
|
|||||||
handlep->stat.ps_ifdrop = 0;
|
handlep->stat.ps_ifdrop = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef HAVE_DAG_STREAMS_API
|
#ifdef HAVE_DAG_STREAMS_API
|
||||||
failstop:
|
failstop:
|
||||||
if (dag_stop_stream(handle->fd, handlep->dag_stream) < 0) {
|
if (dag_stop_stream(handle->fd, handlep->dag_stream) < 0) {
|
||||||
fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));
|
fprintf(stderr,"dag_stop_stream: %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
faildetach:
|
faildetach:
|
||||||
if (dag_detach_stream(handle->fd, handlep->dag_stream) < 0)
|
if (dag_detach_stream(handle->fd, handlep->dag_stream) < 0)
|
||||||
fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
|
fprintf(stderr,"dag_detach_stream: %s\n", strerror(errno));
|
||||||
@@ -852,7 +867,7 @@ failstop:
|
|||||||
if (dag_stop(handle->fd) < 0)
|
if (dag_stop(handle->fd) < 0)
|
||||||
fprintf(stderr,"dag_stop: %s\n", strerror(errno));
|
fprintf(stderr,"dag_stop: %s\n", strerror(errno));
|
||||||
#endif /* HAVE_DAG_STREAMS_API */
|
#endif /* HAVE_DAG_STREAMS_API */
|
||||||
|
|
||||||
failclose:
|
failclose:
|
||||||
if (dag_close(handle->fd) < 0)
|
if (dag_close(handle->fd) < 0)
|
||||||
fprintf(stderr,"dag_close: %s\n", strerror(errno));
|
fprintf(stderr,"dag_close: %s\n", strerror(errno));
|
||||||
@@ -922,6 +937,26 @@ pcap_t *dag_create(const char *device, char *ebuf, int *is_ours)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p->activate_op = dag_activate;
|
p->activate_op = dag_activate;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We claim that we support microsecond and nanosecond time
|
||||||
|
* stamps.
|
||||||
|
*
|
||||||
|
* XXX Our native precision is 2^-32s, but libpcap doesn't support
|
||||||
|
* power of two precisions yet. We can convert to either MICRO or NANO.
|
||||||
|
*/
|
||||||
|
p->tstamp_precision_count = 2;
|
||||||
|
p->tstamp_precision_list = malloc(2 * sizeof(u_int));
|
||||||
|
if (p->tstamp_precision_list == NULL) {
|
||||||
|
snprintf(ebuf, PCAP_ERRBUF_SIZE, "malloc: %s",
|
||||||
|
pcap_strerror(errno));
|
||||||
|
if (p->tstamp_type_list != NULL)
|
||||||
|
free(p->tstamp_type_list);
|
||||||
|
free(p);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
p->tstamp_precision_list[0] = PCAP_TSTAMP_PRECISION_MICRO;
|
||||||
|
p->tstamp_precision_list[1] = PCAP_TSTAMP_PRECISION_NANO;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -934,9 +969,9 @@ dag_stats(pcap_t *p, struct pcap_stat *ps) {
|
|||||||
*/
|
*/
|
||||||
/*pd->stat.ps_recv = 0;*/
|
/*pd->stat.ps_recv = 0;*/
|
||||||
/*pd->stat.ps_drop = 0;*/
|
/*pd->stat.ps_drop = 0;*/
|
||||||
|
|
||||||
*ps = pd->stat;
|
*ps = pd->stat;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -958,6 +993,8 @@ dag_findalldevs(pcap_if_t **devlistp, char *errbuf)
|
|||||||
char dagname[DAGNAME_BUFSIZE];
|
char dagname[DAGNAME_BUFSIZE];
|
||||||
int dagstream;
|
int dagstream;
|
||||||
int dagfd;
|
int dagfd;
|
||||||
|
dag_card_inf_t *inf;
|
||||||
|
char *description;
|
||||||
|
|
||||||
/* Try all the DAGs 0-DAG_MAX_BOARDS */
|
/* Try all the DAGs 0-DAG_MAX_BOARDS */
|
||||||
for (c = 0; c < DAG_MAX_BOARDS; c++) {
|
for (c = 0; c < DAG_MAX_BOARDS; c++) {
|
||||||
@@ -966,8 +1003,11 @@ dag_findalldevs(pcap_if_t **devlistp, char *errbuf)
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
description = NULL;
|
||||||
if ( (dagfd = dag_open(dagname)) >= 0 ) {
|
if ( (dagfd = dag_open(dagname)) >= 0 ) {
|
||||||
if (pcap_add_if(devlistp, name, 0, NULL, errbuf) == -1) {
|
if ((inf = dag_pciinfo(dagfd)))
|
||||||
|
description = dag_device_name(inf->device_code, 1);
|
||||||
|
if (pcap_add_if(devlistp, name, 0, description, errbuf) == -1) {
|
||||||
/*
|
/*
|
||||||
* Failure.
|
* Failure.
|
||||||
*/
|
*/
|
||||||
@@ -982,19 +1022,19 @@ dag_findalldevs(pcap_if_t **devlistp, char *errbuf)
|
|||||||
dag_detach_stream(dagfd, stream);
|
dag_detach_stream(dagfd, stream);
|
||||||
|
|
||||||
snprintf(name, 10, "dag%d:%d", c, stream);
|
snprintf(name, 10, "dag%d:%d", c, stream);
|
||||||
if (pcap_add_if(devlistp, name, 0, NULL, errbuf) == -1) {
|
if (pcap_add_if(devlistp, name, 0, description, errbuf) == -1) {
|
||||||
/*
|
/*
|
||||||
* Failure.
|
* Failure.
|
||||||
*/
|
*/
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rxstreams--;
|
rxstreams--;
|
||||||
if(rxstreams <= 0) {
|
if(rxstreams <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_DAG_STREAMS_API */
|
#endif /* HAVE_DAG_STREAMS_API */
|
||||||
dag_close(dagfd);
|
dag_close(dagfd);
|
||||||
@@ -1054,13 +1094,13 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf)
|
|||||||
uint32_t mindata;
|
uint32_t mindata;
|
||||||
struct timeval maxwait;
|
struct timeval maxwait;
|
||||||
struct timeval poll;
|
struct timeval poll;
|
||||||
|
|
||||||
if (dag_get_stream_poll(p->fd, pd->dag_stream,
|
if (dag_get_stream_poll(p->fd, pd->dag_stream,
|
||||||
&mindata, &maxwait, &poll) < 0) {
|
&mindata, &maxwait, &poll) < 0) {
|
||||||
snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno));
|
snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_get_stream_poll: %s\n", pcap_strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Amount of data to collect in Bytes before calling callbacks.
|
/* Amount of data to collect in Bytes before calling callbacks.
|
||||||
* Important for efficiency, but can introduce latency
|
* Important for efficiency, but can introduce latency
|
||||||
* at low packet rates if to_ms not set!
|
* at low packet rates if to_ms not set!
|
||||||
@@ -1069,7 +1109,7 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf)
|
|||||||
mindata = 0;
|
mindata = 0;
|
||||||
else
|
else
|
||||||
mindata = 65536;
|
mindata = 65536;
|
||||||
|
|
||||||
if (dag_set_stream_poll(p->fd, pd->dag_stream,
|
if (dag_set_stream_poll(p->fd, pd->dag_stream,
|
||||||
mindata, &maxwait, &poll) < 0) {
|
mindata, &maxwait, &poll) < 0) {
|
||||||
snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno));
|
snprintf(errbuf, PCAP_ERRBUF_SIZE, "dag_set_stream_poll: %s\n", pcap_strerror(errno));
|
||||||
@@ -1084,7 +1124,7 @@ dag_setnonblock(pcap_t *p, int nonblock, char *errbuf)
|
|||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dag_get_datalink(pcap_t *p)
|
dag_get_datalink(pcap_t *p)
|
||||||
{
|
{
|
||||||
@@ -1105,18 +1145,18 @@ dag_get_datalink(pcap_t *p)
|
|||||||
/* Get list of possible ERF types for this card */
|
/* Get list of possible ERF types for this card */
|
||||||
if (dag_get_stream_erf_types(p->fd, pd->dag_stream, types, 255) < 0) {
|
if (dag_get_stream_erf_types(p->fd, pd->dag_stream, types, 255) < 0) {
|
||||||
snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_stream_erf_types: %s", pcap_strerror(errno));
|
snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_stream_erf_types: %s", pcap_strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (types[index]) {
|
while (types[index]) {
|
||||||
|
|
||||||
#elif defined HAVE_DAG_GET_ERF_TYPES
|
#elif defined HAVE_DAG_GET_ERF_TYPES
|
||||||
/* Get list of possible ERF types for this card */
|
/* Get list of possible ERF types for this card */
|
||||||
if (dag_get_erf_types(p->fd, types, 255) < 0) {
|
if (dag_get_erf_types(p->fd, types, 255) < 0) {
|
||||||
snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_erf_types: %s", pcap_strerror(errno));
|
snprintf(p->errbuf, sizeof(p->errbuf), "dag_get_erf_types: %s", pcap_strerror(errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (types[index]) {
|
while (types[index]) {
|
||||||
#else
|
#else
|
||||||
/* Check the type through a dagapi call. */
|
/* Check the type through a dagapi call. */
|
||||||
@@ -1162,7 +1202,7 @@ dag_get_datalink(pcap_t *p)
|
|||||||
p->linktype = DLT_EN10MB;
|
p->linktype = DLT_EN10MB;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_ATM:
|
case TYPE_ATM:
|
||||||
case TYPE_AAL5:
|
case TYPE_AAL5:
|
||||||
case TYPE_MC_ATM:
|
case TYPE_MC_ATM:
|
||||||
case TYPE_MC_AAL5:
|
case TYPE_MC_AAL5:
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
* at the same time as another type of device.
|
* at the same time as another type of device.
|
||||||
*
|
*
|
||||||
* Author: Richard Littin, Sean Irvine ({richard,sean}@reeltwo.com)
|
* Author: Richard Littin, Sean Irvine ({richard,sean}@reeltwo.com)
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-dag.h,v 1.7 2008-04-04 19:37:45 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pcap_t *dag_create(const char *, char *, int *);
|
pcap_t *dag_create(const char *, char *, int *);
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. The name of the author may not be used to endorse or promote
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
* products derived from this software without specific prior written
|
* products derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
@@ -122,7 +122,7 @@ dbus_write(pcap_t *handle, const void *buf, size_t size)
|
|||||||
|
|
||||||
dbus_message_unref(msg);
|
dbus_message_unref(msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dbus_stats(pcap_t *handle, struct pcap_stat *stats)
|
dbus_stats(pcap_t *handle, struct pcap_stat *stats)
|
||||||
@@ -250,8 +250,8 @@ dbus_create(const char *device, char *ebuf, int *is_ours)
|
|||||||
{
|
{
|
||||||
pcap_t *p;
|
pcap_t *p;
|
||||||
|
|
||||||
if (strcmp(device, "dbus-system") &&
|
if (strcmp(device, "dbus-system") &&
|
||||||
strcmp(device, "dbus-session") &&
|
strcmp(device, "dbus-session") &&
|
||||||
strncmp(device, "dbus://", 7))
|
strncmp(device, "dbus://", 7))
|
||||||
{
|
{
|
||||||
*is_ours = 0;
|
*is_ours = 0;
|
||||||
@@ -267,7 +267,7 @@ dbus_create(const char *device, char *ebuf, int *is_ours)
|
|||||||
return (p);
|
return (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dbus_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
dbus_findalldevs(pcap_if_t **alldevsp, char *err_str)
|
||||||
{
|
{
|
||||||
if (pcap_add_if(alldevsp, "dbus-system", 0, "D-Bus system bus", err_str) < 0)
|
if (pcap_add_if(alldevsp, "dbus-system", 0, "D-Bus system bus", err_str) < 0)
|
||||||
|
|||||||
@@ -68,11 +68,6 @@
|
|||||||
* DL_HP_RAWDLS?
|
* DL_HP_RAWDLS?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.128 2008-12-02 16:20:23 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -303,7 +298,7 @@ pcap_inject_dlpi(pcap_t *p, const void *buf, size_t size)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
#endif /* raw mode */
|
#endif /* raw mode */
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DL_IPATM
|
#ifndef DL_IPATM
|
||||||
#define DL_IPATM 0x12 /* ATM Classical IP interface */
|
#define DL_IPATM 0x12 /* ATM Classical IP interface */
|
||||||
@@ -341,6 +336,8 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
#ifdef DL_HP_RAWDLS
|
#ifdef DL_HP_RAWDLS
|
||||||
struct pcap_dlpi *pd = p->priv;
|
struct pcap_dlpi *pd = p->priv;
|
||||||
#endif
|
#endif
|
||||||
|
int status = 0;
|
||||||
|
int retv;
|
||||||
register char *cp;
|
register char *cp;
|
||||||
int ppa;
|
int ppa;
|
||||||
#ifdef HAVE_SOLARIS
|
#ifdef HAVE_SOLARIS
|
||||||
@@ -359,7 +356,6 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
#ifndef HAVE_DEV_DLPI
|
#ifndef HAVE_DEV_DLPI
|
||||||
char dname2[100];
|
char dname2[100];
|
||||||
#endif
|
#endif
|
||||||
int status = PCAP_ERROR;
|
|
||||||
|
|
||||||
#ifdef HAVE_DEV_DLPI
|
#ifdef HAVE_DEV_DLPI
|
||||||
/*
|
/*
|
||||||
@@ -397,6 +393,8 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
if ((p->fd = open(cp, O_RDWR)) < 0) {
|
if ((p->fd = open(cp, O_RDWR)) < 0) {
|
||||||
if (errno == EPERM || errno == EACCES)
|
if (errno == EPERM || errno == EACCES)
|
||||||
status = PCAP_ERROR_PERM_DENIED;
|
status = PCAP_ERROR_PERM_DENIED;
|
||||||
|
else
|
||||||
|
status = PCAP_ERROR;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
"%s: %s", cp, pcap_strerror(errno));
|
"%s: %s", cp, pcap_strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
@@ -461,6 +459,8 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
if (errno == EPERM || errno == EACCES)
|
if (errno == EPERM || errno == EACCES)
|
||||||
status = PCAP_ERROR_PERM_DENIED;
|
status = PCAP_ERROR_PERM_DENIED;
|
||||||
|
else
|
||||||
|
status = PCAP_ERROR;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname,
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname,
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
@@ -497,6 +497,8 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
} else {
|
} else {
|
||||||
if (errno == EPERM || errno == EACCES)
|
if (errno == EPERM || errno == EACCES)
|
||||||
status = PCAP_ERROR_PERM_DENIED;
|
status = PCAP_ERROR_PERM_DENIED;
|
||||||
|
else
|
||||||
|
status = PCAP_ERROR;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
|
||||||
dname2, pcap_strerror(errno));
|
dname2, pcap_strerror(errno));
|
||||||
}
|
}
|
||||||
@@ -511,21 +513,28 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** Attach if "style 2" provider
|
** Attach if "style 2" provider
|
||||||
*/
|
*/
|
||||||
if (dlinforeq(p->fd, p->errbuf) < 0 ||
|
if (dlinforeq(p->fd, p->errbuf) < 0 ||
|
||||||
dlinfoack(p->fd, (char *)buf, p->errbuf) < 0)
|
dlinfoack(p->fd, (char *)buf, p->errbuf) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
infop = &(MAKE_DL_PRIMITIVES(buf))->info_ack;
|
infop = &(MAKE_DL_PRIMITIVES(buf))->info_ack;
|
||||||
#ifdef HAVE_SOLARIS
|
#ifdef HAVE_SOLARIS
|
||||||
if (infop->dl_mac_type == DL_IPATM)
|
if (infop->dl_mac_type == DL_IPATM)
|
||||||
isatm = 1;
|
isatm = 1;
|
||||||
#endif
|
#endif
|
||||||
if (infop->dl_provider_style == DL_STYLE2) {
|
if (infop->dl_provider_style == DL_STYLE2) {
|
||||||
status = dl_doattach(p->fd, ppa, p->errbuf);
|
retv = dl_doattach(p->fd, ppa, p->errbuf);
|
||||||
if (status < 0)
|
if (retv < 0) {
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
#ifdef DL_HP_RAWDLS
|
#ifdef DL_HP_RAWDLS
|
||||||
if (pd->send_fd >= 0) {
|
if (pd->send_fd >= 0) {
|
||||||
if (dl_doattach(pd->send_fd, ppa, p->errbuf) < 0)
|
retv = dl_doattach(pd->send_fd, ppa, p->errbuf);
|
||||||
|
if (retv < 0) {
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -572,22 +581,28 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
*/
|
*/
|
||||||
if ((dlbindreq(p->fd, 1537, p->errbuf) < 0 &&
|
if ((dlbindreq(p->fd, 1537, p->errbuf) < 0 &&
|
||||||
dlbindreq(p->fd, 2, p->errbuf) < 0) ||
|
dlbindreq(p->fd, 2, p->errbuf) < 0) ||
|
||||||
dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0)
|
dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
#elif defined(DL_HP_RAWDLS)
|
#elif defined(DL_HP_RAWDLS)
|
||||||
/*
|
/*
|
||||||
** HP-UX 10.0x and 10.1x.
|
** HP-UX 10.0x and 10.1x.
|
||||||
*/
|
*/
|
||||||
if (dl_dohpuxbind(p->fd, p->errbuf) < 0)
|
if (dl_dohpuxbind(p->fd, p->errbuf) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
if (pd->send_fd >= 0) {
|
if (pd->send_fd >= 0) {
|
||||||
/*
|
/*
|
||||||
** XXX - if this fails, just close send_fd and
|
** XXX - if this fails, just close send_fd and
|
||||||
** set it to -1, so that you can't send but can
|
** set it to -1, so that you can't send but can
|
||||||
** still receive?
|
** still receive?
|
||||||
*/
|
*/
|
||||||
if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0)
|
if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else /* neither AIX nor HP-UX */
|
#else /* neither AIX nor HP-UX */
|
||||||
/*
|
/*
|
||||||
@@ -595,8 +610,10 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** OS using DLPI.
|
** OS using DLPI.
|
||||||
**/
|
**/
|
||||||
if (dlbindreq(p->fd, 0, p->errbuf) < 0 ||
|
if (dlbindreq(p->fd, 0, p->errbuf) < 0 ||
|
||||||
dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0)
|
dlbindack(p->fd, (char *)buf, p->errbuf, NULL) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
#endif /* AIX vs. HP-UX vs. other */
|
#endif /* AIX vs. HP-UX vs. other */
|
||||||
#endif /* !HP-UX 9 and !HP-UX 10.20 or later and !SINIX */
|
#endif /* !HP-UX 9 and !HP-UX 10.20 or later and !SINIX */
|
||||||
|
|
||||||
@@ -609,6 +626,7 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** help, and may break things.
|
** help, and may break things.
|
||||||
*/
|
*/
|
||||||
if (strioctl(p->fd, A_PROMISCON_REQ, 0, NULL) < 0) {
|
if (strioctl(p->fd, A_PROMISCON_REQ, 0, NULL) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
"A_PROMISCON_REQ: %s", pcap_strerror(errno));
|
"A_PROMISCON_REQ: %s", pcap_strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
@@ -619,10 +637,12 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
/*
|
/*
|
||||||
** Enable promiscuous (not necessary on send FD)
|
** Enable promiscuous (not necessary on send FD)
|
||||||
*/
|
*/
|
||||||
status = dlpromiscon(p, DL_PROMISC_PHYS);
|
retv = dlpromiscon(p, DL_PROMISC_PHYS);
|
||||||
if (status < 0) {
|
if (retv < 0) {
|
||||||
if (status == PCAP_ERROR_PERM_DENIED)
|
if (retv == PCAP_ERROR_PERM_DENIED)
|
||||||
status = PCAP_ERROR_PROMISC_PERM_DENIED;
|
status = PCAP_ERROR_PROMISC_PERM_DENIED;
|
||||||
|
else
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,8 +652,8 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** HP-UX or SINIX) (Not necessary on send FD)
|
** HP-UX or SINIX) (Not necessary on send FD)
|
||||||
*/
|
*/
|
||||||
#if !defined(__hpux) && !defined(sinix)
|
#if !defined(__hpux) && !defined(sinix)
|
||||||
status = dlpromiscon(p, DL_PROMISC_MULTI);
|
retv = dlpromiscon(p, DL_PROMISC_MULTI);
|
||||||
if (status < 0)
|
if (retv < 0)
|
||||||
status = PCAP_WARNING;
|
status = PCAP_WARNING;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -653,16 +673,23 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
/* Everything else (except for SINIX) - always do this */
|
/* Everything else (except for SINIX) - always do this */
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
status = dlpromiscon(p, DL_PROMISC_SAP);
|
retv = dlpromiscon(p, DL_PROMISC_SAP);
|
||||||
if (status < 0) {
|
if (retv < 0) {
|
||||||
/*
|
if (p->opt.promisc) {
|
||||||
* Not fatal, since the DL_PROMISC_PHYS mode worked.
|
/*
|
||||||
* Report it as a warning, however.
|
* Not fatal, since the DL_PROMISC_PHYS mode
|
||||||
*/
|
* worked.
|
||||||
if (p->opt.promisc)
|
*
|
||||||
|
* Report it as a warning, however.
|
||||||
|
*/
|
||||||
status = PCAP_WARNING;
|
status = PCAP_WARNING;
|
||||||
else
|
} else {
|
||||||
|
/*
|
||||||
|
* Fatal.
|
||||||
|
*/
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* sinix */
|
#endif /* sinix */
|
||||||
@@ -672,8 +699,10 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** promiscuous options.
|
** promiscuous options.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_HPUX9) || defined(HAVE_HPUX10_20_OR_LATER)
|
#if defined(HAVE_HPUX9) || defined(HAVE_HPUX10_20_OR_LATER)
|
||||||
if (dl_dohpuxbind(p->fd, p->errbuf) < 0)
|
if (dl_dohpuxbind(p->fd, p->errbuf) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
** We don't set promiscuous mode on the send FD, but we'll defer
|
** We don't set promiscuous mode on the send FD, but we'll defer
|
||||||
** binding it anyway, just to keep the HP-UX 9/10.20 or later
|
** binding it anyway, just to keep the HP-UX 9/10.20 or later
|
||||||
@@ -685,8 +714,10 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** set it to -1, so that you can't send but can
|
** set it to -1, so that you can't send but can
|
||||||
** still receive?
|
** still receive?
|
||||||
*/
|
*/
|
||||||
if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0)
|
if (dl_dohpuxbind(pd->send_fd, p->errbuf) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -696,12 +727,16 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** when sending packets.
|
** when sending packets.
|
||||||
*/
|
*/
|
||||||
if (dlinforeq(p->fd, p->errbuf) < 0 ||
|
if (dlinforeq(p->fd, p->errbuf) < 0 ||
|
||||||
dlinfoack(p->fd, (char *)buf, p->errbuf) < 0)
|
dlinfoack(p->fd, (char *)buf, p->errbuf) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
infop = &(MAKE_DL_PRIMITIVES(buf))->info_ack;
|
infop = &(MAKE_DL_PRIMITIVES(buf))->info_ack;
|
||||||
if (pcap_process_mactype(p, infop->dl_mac_type) != 0)
|
if (pcap_process_mactype(p, infop->dl_mac_type) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DLIOCRAW
|
#ifdef DLIOCRAW
|
||||||
/*
|
/*
|
||||||
@@ -709,6 +744,7 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
** header.
|
** header.
|
||||||
*/
|
*/
|
||||||
if (strioctl(p->fd, DLIOCRAW, 0, NULL) < 0) {
|
if (strioctl(p->fd, DLIOCRAW, 0, NULL) < 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "DLIOCRAW: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "DLIOCRAW: %s",
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
@@ -739,28 +775,31 @@ pcap_activate_dlpi(pcap_t *p)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Push and configure bufmod. */
|
/* Push and configure bufmod. */
|
||||||
if (pcap_conf_bufmod(p, ss) != 0)
|
if (pcap_conf_bufmod(p, ss) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** As the last operation flush the read side.
|
** As the last operation flush the read side.
|
||||||
*/
|
*/
|
||||||
if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) {
|
if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "FLUSHR: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "FLUSHR: %s",
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate data buffer. */
|
/* Allocate data buffer. */
|
||||||
if (pcap_alloc_databuf(p) != 0)
|
if (pcap_alloc_databuf(p) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
/* Success - but perhaps with a warning */
|
|
||||||
if (status < 0)
|
|
||||||
status = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* Success.
|
||||||
|
*
|
||||||
* "p->fd" is an FD for a STREAMS device, so "select()" and
|
* "p->fd" is an FD for a STREAMS device, so "select()" and
|
||||||
* "poll()" should work on it.
|
* "poll()" should work on it.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
*
|
*
|
||||||
* pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
|
* pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
|
||||||
* network drivers.
|
* network drivers.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-dos.c,v 1.7 2008-04-22 17:16:30 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -168,7 +166,7 @@ pcap_t *pcap_create_interface (const char *device, char *ebuf)
|
|||||||
* network packets.
|
* network packets.
|
||||||
*/
|
*/
|
||||||
static int pcap_activate_dos (pcap_t *pcap)
|
static int pcap_activate_dos (pcap_t *pcap)
|
||||||
{
|
{
|
||||||
struct pcap_dos *pcapd = pcap->priv;
|
struct pcap_dos *pcapd = pcap->priv;
|
||||||
|
|
||||||
if (pcap->opt.rfmon) {
|
if (pcap->opt.rfmon) {
|
||||||
@@ -199,7 +197,7 @@ static int pcap_activate_dos (pcap_t *pcap)
|
|||||||
!first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
|
!first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
|
||||||
{
|
{
|
||||||
return (PCAP_ERROR);
|
return (PCAP_ERROR);
|
||||||
}
|
}
|
||||||
atexit (close_driver);
|
atexit (close_driver);
|
||||||
}
|
}
|
||||||
else if (stricmp(active_dev->name,pcap->opt.source))
|
else if (stricmp(active_dev->name,pcap->opt.source))
|
||||||
@@ -403,7 +401,7 @@ int pcap_stats_ex (pcap_t *p, struct pcap_stat_ex *se)
|
|||||||
strlcpy (p->errbuf, "pktdrvr doesn't have detailed statistics",
|
strlcpy (p->errbuf, "pktdrvr doesn't have detailed statistics",
|
||||||
PCAP_ERRBUF_SIZE);
|
PCAP_ERRBUF_SIZE);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
memcpy (se, (*dev->get_stats)(dev), sizeof(*se));
|
memcpy (se, (*dev->get_stats)(dev), sizeof(*se));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -522,7 +520,7 @@ int pcap_lookupnet (const char *device, bpf_u_int32 *localnet,
|
|||||||
}
|
}
|
||||||
ARGSUSED (device);
|
ARGSUSED (device);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a list of all interfaces that are present and that we probe okay.
|
* Get a list of all interfaces that are present and that we probe okay.
|
||||||
@@ -962,7 +960,7 @@ static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
|
|||||||
* have default values. Should be taken from another
|
* have default values. Should be taken from another
|
||||||
* ini-file/environment in any case (ref. tcpdump.ini)
|
* ini-file/environment in any case (ref. tcpdump.ini)
|
||||||
*/
|
*/
|
||||||
_watt_is_init = 1;
|
_watt_is_init = 1;
|
||||||
|
|
||||||
if (!using_pktdrv || !has_ip_addr) /* for now .... */
|
if (!using_pktdrv || !has_ip_addr) /* for now .... */
|
||||||
{
|
{
|
||||||
@@ -1094,7 +1092,7 @@ static int pkt_open (struct device *dev)
|
|||||||
|
|
||||||
if (!PktInitDriver(mode))
|
if (!PktInitDriver(mode))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
PktResetStatistics (pktInfo.handle);
|
PktResetStatistics (pktInfo.handle);
|
||||||
PktQueueBusy (FALSE);
|
PktQueueBusy (FALSE);
|
||||||
return (1);
|
return (1);
|
||||||
@@ -1292,7 +1290,7 @@ struct device rtl8139_dev LOCKED_VAR = {
|
|||||||
0,0,0,0,0,0,
|
0,0,0,0,0,0,
|
||||||
&cs89_dev,
|
&cs89_dev,
|
||||||
rtl8139_probe /* dev->probe routine */
|
rtl8139_probe /* dev->probe routine */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dequeue routine is called by polling.
|
* Dequeue routine is called by polling.
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Internal details for libpcap on DOS.
|
* Internal details for libpcap on DOS.
|
||||||
* 32-bit targets: djgpp, Pharlap or DOS4GW.
|
* 32-bit targets: djgpp, Pharlap or DOS4GW.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-dos.h,v 1.1 2004-12-18 08:52:10 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PCAP_DOS_H
|
#ifndef __PCAP_DOS_H
|
||||||
@@ -216,7 +214,7 @@ extern void _w32_os_yield (void); /* Watt-32's misc.c */
|
|||||||
#define PCAP_ASSERT(x) ((void)0)
|
#define PCAP_ASSERT(x) ((void)0)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
void pcap_assert (const char *what, const char *file, unsigned line);
|
void pcap_assert (const char *what, const char *file, unsigned line);
|
||||||
|
|
||||||
#define PCAP_ASSERT(x) do { \
|
#define PCAP_ASSERT(x) do { \
|
||||||
if (!(x)) \
|
if (!(x)) \
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
*
|
*
|
||||||
* Rayan Zachariassen, CA*Net
|
* Rayan Zachariassen, CA*Net
|
||||||
*/
|
*/
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-enet.c,v 1.9 2006-10-04 18:09:22 guy Exp $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
.\" @(#) $Header: /tcpdump/master/libpcap/pcap-filter.manmisc.in,v 1.1 2008-10-21 07:33:01 guy Exp $ (LBL)
|
|
||||||
.\"
|
|
||||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@@ -20,7 +18,7 @@
|
|||||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
.\"
|
.\"
|
||||||
.TH PCAP-FILTER @MAN_MISC_INFO@ "6 January 2008"
|
.TH PCAP-FILTER @MAN_MISC_INFO@ "17 May 2013"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
pcap-filter \- packet filter syntax
|
pcap-filter \- packet filter syntax
|
||||||
.br
|
.br
|
||||||
@@ -332,8 +330,9 @@ The packet may contain, for example,
|
|||||||
authentication header, routing header, or hop-by-hop option header,
|
authentication header, routing header, or hop-by-hop option header,
|
||||||
between IPv6 header and TCP header.
|
between IPv6 header and TCP header.
|
||||||
The BPF code emitted by this primitive is complex and
|
The BPF code emitted by this primitive is complex and
|
||||||
cannot be optimized by the BPF optimizer code, so this can be somewhat
|
cannot be optimized by the BPF optimizer code, and is not supported by
|
||||||
slow.
|
filter engines in the kernel, so this can be somewhat slow, and may
|
||||||
|
cause more packets to be dropped.
|
||||||
.IP "\fBip protochain \fIprotocol\fR"
|
.IP "\fBip protochain \fIprotocol\fR"
|
||||||
Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
|
Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
|
||||||
.IP "\fBprotochain \fIprotocol\fR"
|
.IP "\fBprotochain \fIprotocol\fR"
|
||||||
@@ -453,6 +452,67 @@ True if the DECNET destination address is
|
|||||||
.IP "\fBdecnet host \fIhost\fR"
|
.IP "\fBdecnet host \fIhost\fR"
|
||||||
True if either the DECNET source or destination address is
|
True if either the DECNET source or destination address is
|
||||||
.IR host .
|
.IR host .
|
||||||
|
.IP \fBllc\fP
|
||||||
|
True if the packet has an 802.2 LLC header. This includes:
|
||||||
|
.IP
|
||||||
|
Ethernet packets with a length field rather than a type field that
|
||||||
|
aren't raw NetWare-over-802.3 packets;
|
||||||
|
.IP
|
||||||
|
IEEE 802.11 data packets;
|
||||||
|
.IP
|
||||||
|
Token Ring packets (no check is done for LLC frames);
|
||||||
|
.IP
|
||||||
|
FDDI packets (no check is done for LLC frames);
|
||||||
|
.IP
|
||||||
|
LLC-encapsulated ATM packets, for SunATM on Solaris.
|
||||||
|
.IP
|
||||||
|
|
||||||
|
.IP "\fBllc\fP \Fitype\fR"
|
||||||
|
True if the packet has an 802.2 LLC header and has the specified
|
||||||
|
.IR type .
|
||||||
|
.I type
|
||||||
|
can be one of:
|
||||||
|
.RS
|
||||||
|
.TP
|
||||||
|
\fBi\fR
|
||||||
|
Information (I) PDUs
|
||||||
|
.TP
|
||||||
|
\fBs\fR
|
||||||
|
Supervisory (S) PDUs
|
||||||
|
.TP
|
||||||
|
\fBu\fR
|
||||||
|
Unnumbered (U) PDUs
|
||||||
|
.TP
|
||||||
|
\fBrr\fR
|
||||||
|
Receiver Ready (RR) S PDUs
|
||||||
|
.TP
|
||||||
|
\fBrnr\fR
|
||||||
|
Receiver Not Ready (RNR) S PDUs
|
||||||
|
.TP
|
||||||
|
\fBrej\fR
|
||||||
|
Reject (REJ) S PDUs
|
||||||
|
.TP
|
||||||
|
\fBui\fR
|
||||||
|
Unnumbered Information (UI) U PDUs
|
||||||
|
.TP
|
||||||
|
\fBua\fR
|
||||||
|
Unnumbered Acknowledgment (UA) U PDUs
|
||||||
|
.TP
|
||||||
|
\fBdisc\fR
|
||||||
|
Disconnect (DISC) U PDUs
|
||||||
|
.TP
|
||||||
|
\fBsabme\fR
|
||||||
|
Set Asynchronous Balanced Mode Extended (SABME) U PDUs
|
||||||
|
.TP
|
||||||
|
\fBtest\fR
|
||||||
|
Test (TEST) U PDUs
|
||||||
|
.TP
|
||||||
|
\fBxid\fR
|
||||||
|
Exchange Identification (XID) U PDUs
|
||||||
|
.TP
|
||||||
|
\fBfrmr\fR
|
||||||
|
Frame Reject (FRMR) U PDUs
|
||||||
|
.RE
|
||||||
.IP "\fBifname \fIinterface\fR"
|
.IP "\fBifname \fIinterface\fR"
|
||||||
True if the packet was logged as coming from the specified interface (applies
|
True if the packet was logged as coming from the specified interface (applies
|
||||||
only to packets logged by OpenBSD's or FreeBSD's
|
only to packets logged by OpenBSD's or FreeBSD's
|
||||||
@@ -487,7 +547,7 @@ name of an anchored ruleset (applies only to packets logged by OpenBSD's
|
|||||||
or FreeBSD's
|
or FreeBSD's
|
||||||
.BR pf (4)).
|
.BR pf (4)).
|
||||||
.IP "\fBruleset \fIname\fR"
|
.IP "\fBruleset \fIname\fR"
|
||||||
Synonomous with the
|
Synonymous with the
|
||||||
.B rset
|
.B rset
|
||||||
modifier.
|
modifier.
|
||||||
.IP "\fBsrnr \fInum\fR"
|
.IP "\fBsrnr \fInum\fR"
|
||||||
@@ -496,7 +556,7 @@ of an anchored ruleset (applies only to packets logged by OpenBSD's or
|
|||||||
FreeBSD's
|
FreeBSD's
|
||||||
.BR pf (4)).
|
.BR pf (4)).
|
||||||
.IP "\fBsubrulenum \fInum\fR"
|
.IP "\fBsubrulenum \fInum\fR"
|
||||||
Synonomous with the
|
Synonymous with the
|
||||||
.B srnr
|
.B srnr
|
||||||
modifier.
|
modifier.
|
||||||
.IP "\fBaction \fIact\fR"
|
.IP "\fBaction \fIact\fR"
|
||||||
@@ -637,7 +697,7 @@ changes the decoding offsets for the remainder of \fIexpression\fR on
|
|||||||
the assumption that the packet is a MPLS-encapsulated IP packet. The
|
the assumption that the packet is a MPLS-encapsulated IP packet. The
|
||||||
\fBmpls \fI[label_num]\fR expression may be used more than once, to
|
\fBmpls \fI[label_num]\fR expression may be used more than once, to
|
||||||
filter on MPLS hierarchies. Each use of that expression increments the
|
filter on MPLS hierarchies. Each use of that expression increments the
|
||||||
filter offsets by 4.
|
filter offsets by 4.
|
||||||
.IP
|
.IP
|
||||||
For example:
|
For example:
|
||||||
.in +.5i
|
.in +.5i
|
||||||
@@ -673,6 +733,22 @@ For example:
|
|||||||
.fi
|
.fi
|
||||||
.in -.5i
|
.in -.5i
|
||||||
filters IPv4 protocols encapsulated in PPPoE session id 0x27.
|
filters IPv4 protocols encapsulated in PPPoE session id 0x27.
|
||||||
|
.IP "\fBgeneve \fI[vni]\fR"
|
||||||
|
True if the packet is a Geneve packet (UDP port 6081). If \fI[vni]\fR
|
||||||
|
is specified, only true if the packet has the specified \fIvni\fR.
|
||||||
|
Note that when the \fBgeneve\fR keyword is encountered in
|
||||||
|
\fIexpression\fR, it changes the decoding offsets for the remainder of
|
||||||
|
\fIexpression\fR on the assumption that the packet is a Geneve packet.
|
||||||
|
.IP
|
||||||
|
For example:
|
||||||
|
.in +.5i
|
||||||
|
.nf
|
||||||
|
\fBgeneve 0xb && ip\fR
|
||||||
|
.fi
|
||||||
|
.in -.5i
|
||||||
|
filters IPv4 protocols encapsulated in Geneve with VNI 0xb. This will
|
||||||
|
match both IP directly encapsulated in Geneve as well as IP contained
|
||||||
|
inside an Ethernet frame.
|
||||||
.IP "\fBiso proto \fIprotocol\fR"
|
.IP "\fBiso proto \fIprotocol\fR"
|
||||||
True if the packet is an OSI packet of protocol type \fIprotocol\fP.
|
True if the packet is an OSI packet of protocol type \fIprotocol\fP.
|
||||||
\fIProtocol\fP can be a number or one of the names
|
\fIProtocol\fP can be a number or one of the names
|
||||||
@@ -704,9 +780,6 @@ on the assumption that the packet is either a LANE emulated Ethernet
|
|||||||
packet or a LANE LE Control packet. If \fBlane\fR isn't specified, the
|
packet or a LANE LE Control packet. If \fBlane\fR isn't specified, the
|
||||||
tests are done under the assumption that the packet is an
|
tests are done under the assumption that the packet is an
|
||||||
LLC-encapsulated packet.
|
LLC-encapsulated packet.
|
||||||
.IP \fBllc\fP
|
|
||||||
True if the packet is an ATM packet, for SunATM on Solaris, and is
|
|
||||||
an LLC-encapsulated packet.
|
|
||||||
.IP \fBoamf4s\fP
|
.IP \fBoamf4s\fP
|
||||||
True if the packet is an ATM packet, for SunATM on Solaris, and is
|
True if the packet is an ATM packet, for SunATM on Solaris, and is
|
||||||
a segment OAM F4 flow cell (VPI=0 & VCI=3).
|
a segment OAM F4 flow cell (VPI=0 & VCI=3).
|
||||||
@@ -743,11 +816,17 @@ Release, or Release Done message.
|
|||||||
True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =,
|
True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =,
|
||||||
!=, and \fIexpr\fR is an arithmetic expression composed of integer
|
!=, and \fIexpr\fR is an arithmetic expression composed of integer
|
||||||
constants (expressed in standard C syntax), the normal binary operators
|
constants (expressed in standard C syntax), the normal binary operators
|
||||||
[+, -, *, /, &, |, <<, >>], a length operator, and special packet data
|
[+, -, *, /, %, &, |, ^, <<, >>], a length operator, and special packet data
|
||||||
accessors. Note that all comparisons are unsigned, so that, for example,
|
accessors. Note that all comparisons are unsigned, so that, for example,
|
||||||
0x80000000 and 0xffffffff are > 0.
|
0x80000000 and 0xffffffff are > 0.
|
||||||
To access
|
.IP
|
||||||
data inside the packet, use the following syntax:
|
The % and ^ operators are currently only supported for filtering in the
|
||||||
|
kernel on Linux with 3.7 and later kernels; on all other systems, if
|
||||||
|
those operators are used, filtering will be done in user mode, which
|
||||||
|
will increase the overhead of capturing packets and may cause more
|
||||||
|
packets to be dropped.
|
||||||
|
.IP
|
||||||
|
To access data inside the packet, use the following syntax:
|
||||||
.in +.5i
|
.in +.5i
|
||||||
.nf
|
.nf
|
||||||
\fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
|
\fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.94 2008-09-16 00:20:23 guy Exp $ (LBL)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef pcap_int_h
|
#ifndef pcap_int_h
|
||||||
@@ -84,6 +82,29 @@ extern CRITICAL_SECTION g_PcapCompileCriticalSection;
|
|||||||
|
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Maximum snapshot length.
|
||||||
|
*
|
||||||
|
* Somewhat arbitrary, but chosen to be:
|
||||||
|
*
|
||||||
|
* 1) big enough for maximum-size Linux loopback packets (65549)
|
||||||
|
* and some USB packets captured with USBPcap:
|
||||||
|
*
|
||||||
|
* http://desowin.org/usbpcap/
|
||||||
|
*
|
||||||
|
* (> 131072, < 262144)
|
||||||
|
*
|
||||||
|
* and
|
||||||
|
*
|
||||||
|
* 2) small enough not to cause attempts to allocate huge amounts of
|
||||||
|
* memory; some applications might use the snapshot length in a
|
||||||
|
* savefile header to control the size of the buffer they allocate,
|
||||||
|
* so a size of, say, 2^31-1 might not work well.
|
||||||
|
*
|
||||||
|
* We don't enforce this in pcap_set_snaplen(), but we use it internally.
|
||||||
|
*/
|
||||||
|
#define MAXIMUM_SNAPLEN 262144
|
||||||
|
|
||||||
struct pcap_opt {
|
struct pcap_opt {
|
||||||
char *source;
|
char *source;
|
||||||
int timeout; /* timeout for buffering */
|
int timeout; /* timeout for buffering */
|
||||||
@@ -181,6 +202,11 @@ struct pcap {
|
|||||||
/* We're accepting only packets in this direction/these directions. */
|
/* We're accepting only packets in this direction/these directions. */
|
||||||
pcap_direction_t direction;
|
pcap_direction_t direction;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flags to affect BPF code generation.
|
||||||
|
*/
|
||||||
|
int bpf_codegen_flags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Placeholder for filter code if bpf not in kernel.
|
* Placeholder for filter code if bpf not in kernel.
|
||||||
*/
|
*/
|
||||||
@@ -227,6 +253,11 @@ struct pcap {
|
|||||||
cleanup_op_t cleanup_op;
|
cleanup_op_t cleanup_op;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BPF code generation flags.
|
||||||
|
*/
|
||||||
|
#define BPF_SPECIAL_VLAN_HANDLING 0x00000001 /* special VLAN handling for Linux */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a timeval as stored in a savefile.
|
* This is a timeval as stored in a savefile.
|
||||||
* It has to use the same types everywhere, independent of the actual
|
* It has to use the same types everywhere, independent of the actual
|
||||||
@@ -387,6 +418,9 @@ int pcap_platform_finddevs(pcap_if_t **, char *);
|
|||||||
int add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *,
|
int add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *,
|
||||||
size_t, struct sockaddr *, size_t, struct sockaddr *, size_t,
|
size_t, struct sockaddr *, size_t, struct sockaddr *, size_t,
|
||||||
struct sockaddr *, size_t, char *);
|
struct sockaddr *, size_t, char *);
|
||||||
|
int add_addr_to_dev(pcap_if_t *, struct sockaddr *, size_t,
|
||||||
|
struct sockaddr *, size_t, struct sockaddr *, size_t,
|
||||||
|
struct sockaddr *dstaddr, size_t, char *errbuf);
|
||||||
int pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *);
|
int pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *);
|
||||||
struct sockaddr *dup_sockaddr(struct sockaddr *, size_t);
|
struct sockaddr *dup_sockaddr(struct sockaddr *, size_t);
|
||||||
int add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int,
|
int add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int,
|
||||||
|
|||||||
@@ -24,11 +24,6 @@
|
|||||||
* Packet capture routines for DLPI using libdlpi under SunOS 5.11.
|
* Packet capture routines for DLPI using libdlpi under SunOS 5.11.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static const char rcsid[] _U_ =
|
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-libdlpi.c,v 1.6 2008-04-14 20:40:58 guy Exp $ (LBL)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -101,10 +96,10 @@ static int
|
|||||||
pcap_activate_libdlpi(pcap_t *p)
|
pcap_activate_libdlpi(pcap_t *p)
|
||||||
{
|
{
|
||||||
struct pcap_dlpi *pd = p->priv;
|
struct pcap_dlpi *pd = p->priv;
|
||||||
|
int status = 0;
|
||||||
int retv;
|
int retv;
|
||||||
dlpi_handle_t dh;
|
dlpi_handle_t dh;
|
||||||
dlpi_info_t dlinfo;
|
dlpi_info_t dlinfo;
|
||||||
int err = PCAP_ERROR;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable Solaris raw and passive DLPI extensions;
|
* Enable Solaris raw and passive DLPI extensions;
|
||||||
@@ -114,13 +109,15 @@ pcap_activate_libdlpi(pcap_t *p)
|
|||||||
retv = dlpi_open(p->opt.source, &dh, DLPI_RAW|DLPI_PASSIVE);
|
retv = dlpi_open(p->opt.source, &dh, DLPI_RAW|DLPI_PASSIVE);
|
||||||
if (retv != DLPI_SUCCESS) {
|
if (retv != DLPI_SUCCESS) {
|
||||||
if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
|
if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
|
||||||
err = PCAP_ERROR_NO_SUCH_DEVICE;
|
status = PCAP_ERROR_NO_SUCH_DEVICE;
|
||||||
else if (retv == DL_SYSERR &&
|
else if (retv == DL_SYSERR &&
|
||||||
(errno == EPERM || errno == EACCES))
|
(errno == EPERM || errno == EACCES))
|
||||||
err = PCAP_ERROR_PERM_DENIED;
|
status = PCAP_ERROR_PERM_DENIED;
|
||||||
|
else
|
||||||
|
status = PCAP_ERROR;
|
||||||
pcap_libdlpi_err(p->opt.source, "dlpi_open", retv,
|
pcap_libdlpi_err(p->opt.source, "dlpi_open", retv,
|
||||||
p->errbuf);
|
p->errbuf);
|
||||||
return (err);
|
return (status);
|
||||||
}
|
}
|
||||||
pd->dlpi_hd = dh;
|
pd->dlpi_hd = dh;
|
||||||
|
|
||||||
@@ -129,20 +126,21 @@ pcap_activate_libdlpi(pcap_t *p)
|
|||||||
* This device exists, but we don't support monitor mode
|
* This device exists, but we don't support monitor mode
|
||||||
* any platforms that support DLPI.
|
* any platforms that support DLPI.
|
||||||
*/
|
*/
|
||||||
err = PCAP_ERROR_RFMON_NOTSUP;
|
status = PCAP_ERROR_RFMON_NOTSUP;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bind with DLPI_ANY_SAP. */
|
/* Bind with DLPI_ANY_SAP. */
|
||||||
if ((retv = dlpi_bind(pd->dlpi_hd, DLPI_ANY_SAP, 0)) != DLPI_SUCCESS) {
|
if ((retv = dlpi_bind(pd->dlpi_hd, DLPI_ANY_SAP, 0)) != DLPI_SUCCESS) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
pcap_libdlpi_err(p->opt.source, "dlpi_bind", retv, p->errbuf);
|
pcap_libdlpi_err(p->opt.source, "dlpi_bind", retv, p->errbuf);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable promiscuous mode. */
|
/* Enable promiscuous mode. */
|
||||||
if (p->opt.promisc) {
|
if (p->opt.promisc) {
|
||||||
err = dlpromiscon(p, DL_PROMISC_PHYS);
|
retv = dlpromiscon(p, DL_PROMISC_PHYS);
|
||||||
if (err < 0) {
|
if (retv < 0) {
|
||||||
/*
|
/*
|
||||||
* "You don't have permission to capture on
|
* "You don't have permission to capture on
|
||||||
* this device" and "you don't have permission
|
* this device" and "you don't have permission
|
||||||
@@ -156,57 +154,71 @@ pcap_activate_libdlpi(pcap_t *p)
|
|||||||
* XXX - you might have to capture in
|
* XXX - you might have to capture in
|
||||||
* promiscuous mode to see outgoing packets.
|
* promiscuous mode to see outgoing packets.
|
||||||
*/
|
*/
|
||||||
if (err == PCAP_ERROR_PERM_DENIED)
|
if (retv == PCAP_ERROR_PERM_DENIED)
|
||||||
err = PCAP_ERROR_PROMISC_PERM_DENIED;
|
status = PCAP_ERROR_PROMISC_PERM_DENIED;
|
||||||
|
else
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Try to enable multicast. */
|
/* Try to enable multicast. */
|
||||||
err = dlpromiscon(p, DL_PROMISC_MULTI);
|
retv = dlpromiscon(p, DL_PROMISC_MULTI);
|
||||||
if (err < 0)
|
if (retv < 0) {
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to enable SAP promiscuity. */
|
/* Try to enable SAP promiscuity. */
|
||||||
err = dlpromiscon(p, DL_PROMISC_SAP);
|
retv = dlpromiscon(p, DL_PROMISC_SAP);
|
||||||
if (err < 0) {
|
if (retv < 0) {
|
||||||
/*
|
/*
|
||||||
* Not fatal, since the DL_PROMISC_PHYS mode worked.
|
* Not fatal, since the DL_PROMISC_PHYS mode worked.
|
||||||
* Report it as a warning, however.
|
* Report it as a warning, however.
|
||||||
*/
|
*/
|
||||||
if (p->opt.promisc)
|
if (p->opt.promisc)
|
||||||
err = PCAP_WARNING;
|
status = PCAP_WARNING;
|
||||||
else
|
else {
|
||||||
|
status = retv;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine link type. */
|
/* Determine link type. */
|
||||||
if ((retv = dlpi_info(pd->dlpi_hd, &dlinfo, 0)) != DLPI_SUCCESS) {
|
if ((retv = dlpi_info(pd->dlpi_hd, &dlinfo, 0)) != DLPI_SUCCESS) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
pcap_libdlpi_err(p->opt.source, "dlpi_info", retv, p->errbuf);
|
pcap_libdlpi_err(p->opt.source, "dlpi_info", retv, p->errbuf);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcap_process_mactype(p, dlinfo.di_mactype) != 0)
|
if (pcap_process_mactype(p, dlinfo.di_mactype) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
p->fd = dlpi_fd(pd->dlpi_hd);
|
p->fd = dlpi_fd(pd->dlpi_hd);
|
||||||
|
|
||||||
/* Push and configure bufmod. */
|
/* Push and configure bufmod. */
|
||||||
if (pcap_conf_bufmod(p, p->snapshot) != 0)
|
if (pcap_conf_bufmod(p, p->snapshot) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flush the read side.
|
* Flush the read side.
|
||||||
*/
|
*/
|
||||||
if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) {
|
if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "FLUSHR: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "FLUSHR: %s",
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate data buffer. */
|
/* Allocate data buffer. */
|
||||||
if (pcap_alloc_databuf(p) != 0)
|
if (pcap_alloc_databuf(p) != 0) {
|
||||||
|
status = PCAP_ERROR;
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "p->fd" is a FD for a STREAMS device, so "select()" and
|
* "p->fd" is a FD for a STREAMS device, so "select()" and
|
||||||
@@ -224,10 +236,10 @@ pcap_activate_libdlpi(pcap_t *p)
|
|||||||
p->stats_op = pcap_stats_dlpi;
|
p->stats_op = pcap_stats_dlpi;
|
||||||
p->cleanup_op = pcap_cleanup_libdlpi;
|
p->cleanup_op = pcap_cleanup_libdlpi;
|
||||||
|
|
||||||
return (0);
|
return (status);
|
||||||
bad:
|
bad:
|
||||||
pcap_cleanup_libdlpi(p);
|
pcap_cleanup_libdlpi(p);
|
||||||
return (err);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STRINGIFY(n) #n
|
#define STRINGIFY(n) #n
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
.\" @(#) $Header: /tcpdump/master/libpcap/pcap-linktype.manmisc.in,v 1.3 2008-10-27 22:52:30 guy Exp $
|
|
||||||
.\"
|
|
||||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@@ -20,7 +18,7 @@
|
|||||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
.\"
|
.\"
|
||||||
.TH PCAP-LINKTYPE @MAN_MISC_INFO@ "23 October 2008"
|
.TH PCAP-LINKTYPE @MAN_MISC_INFO@ "12 March 2011"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
pcap-linktype \- link-layer header types supported by libpcap
|
pcap-linktype \- link-layer header types supported by libpcap
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user