Franz Schaefer <schaefer at mond dot at>
Fulko Hew <fulko dot hew at gmail dot com>
Fumiyuki Shimizu <fumifumi at abacustech dot jp>
- Gianluca Varenni <varenni at netgroup-serv dot polito dot it>
+ Garrett Cooper <yaberauneya at sourceforge dot net>
+ Gianluca Varenni <gianluca dot varenni at gmail dot com>
Gilbert Hoyek <gil_hoyek at hotmail dot com>
Gisle Vanem <gvanem at broadpark dot no>
Graeme Hewson <ghewson at cix dot compulink dot co dot uk>
Gregor Maier <gregor at net dot in dot tum dot de>
Guillaume Pelat <endymion_ at users dot sourceforge dot net>
Hagen Paul Pfeifer <hagen at jauu dot net>
+ Henri Doreau <hdoreau at sourceforge dot net>
Hyung Sik Yoon <hsyn at kr dot ibm dot com>
Igor Khristophorov <igor at atdot dot org>
Jan-Philip Velders <jpv at veldersjes dot net>
Jean Tourrilhes <jt at hpl dot hp dot com>
Jean-Louis Charton <Jean-Louis.CHARTON at oikialog dot com>
Jefferson Ogata <jogata at nodc dot noaa dot gov>
+ Jesper Dangaard Brouer <hawk at comx dot dk>
Jesper Peterson <jesper at endace dot com>
Joerg Mayer <jmayer at loplof dot de>
John Bankier <jbankier at rainfinity dot com>
Jon Lindgren <jonl at yubyub dot net>
Jon Smirl <jonsmirl at gmail dot com>
Juergen Schoenwaelder <schoenw at ibr dot cs dot tu-bs dot de>
+ Julien Moutinho <julm at savines dot alpes dot fr dot eu dot org>
Jung-uk Kim <jkim at FreeBSD dot org>
Kazushi Sugyo <sugyo at pb dot jp dot nec dot com>
Klaus Klein <kleink at netbsd dot org>
Mike Frysinger <vapier at gmail dot com>
Mike Kershaw <dragorn at kismetwireless dot net>
Mike Wiacek <mike at iroot dot net>
+ Miroslav Lichvar <mlichvar at redhat dot com>
Monroe Williams <monroe at pobox dot com>
<nvercamm at sourceforge dot net>
N. Leiten <nleiten at sourceforge dot net>
Sagun Shakya <sagun dot shakya at sun dot com>
Scott Barron <sb125499 at ohiou dot edu>
Scott Gifford <sgifford at tir dot com>
- Scott Mcmillan <scott.a.mcmillan at intel dot com>
+ Scott Mcmillan <scott dot a dot mcmillan at intel dot com>
Sebastian Krahmer <krahmer at cs dot uni-potsdam dot de>
Sebastien Roy <Sebastien dot Roy at Sun dot COM>
Sepherosa Ziehau <sepherosa at gmail dot com>
-1.2.0-PRE-GIT
+1.3.0-PRE-GIT
/* define if you have streams capable DAG API */
#undef HAVE_DAG_STREAMS_API
+/* define if you have vdag_set_device_info() */
+#undef HAVE_DAG_VDAG
+
/* Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
don't. */
#undef HAVE_DECL_ETHER_HOSTTON
if test -z "$dag_tools_dir"; then
dag_tools_dir="$dag_root/tools"
- fi
+ fi
if test -r $dag_include_dir/dagapi.h; then
ac_cv_lbl_dag_api=yes
echo "${ECHO_T}$ac_cv_lbl_dag_api ($dag_include_dir)" >&6; }
fi
-if test $ac_cv_lbl_dag_api = yes; then
-
- { echo "$as_me:$LINENO: checking dagapi.o" >&5
-echo $ECHO_N "checking dagapi.o... $ECHO_C" >&6; }
- dagapi_obj=no
- if test -r $dag_tools_dir/dagapi.o; then
- # 2.4.x.
- dagapi_obj=$dag_tools_dir/dagapi.o
- elif test -r $dag_lib_dir/dagapi.o; then
- # 2.5.x.
- dagapi_obj=$dag_lib_dir/dagapi.o
- elif test -r $dag_lib_dir/libdag.a; then
- # 2.5.x.
- ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null
- if test -r ./dagapi.o; then
- dagapi_obj=./dagapi.o
- else
- ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null
- if test -r ./libdag_la-dagapi.o; then
- dagapi_obj=./libdag_la-dagapi.o
- fi
- fi
- fi
-
- if test $dagapi_obj = no; then
- { echo "$as_me:$LINENO: result: no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&5
-echo "${ECHO_T}no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&6; }
- ac_cv_lbl_dag_api=no
- else
- { echo "$as_me:$LINENO: result: yes ($dagapi_obj)" >&5
-echo "${ECHO_T}yes ($dagapi_obj)" >&6; }
- fi
-fi
-
-if test $ac_cv_lbl_dag_api = yes; then
-
- { echo "$as_me:$LINENO: checking dagopts.o" >&5
-echo $ECHO_N "checking dagopts.o... $ECHO_C" >&6; }
- dagopts_obj=no
- if test -r $dag_tools_dir/dagopts.o; then
- # 2.4.x.
- dagopts_obj=$dag_tools_dir/dagopts.o
- elif test -r $dag_lib_dir/dagopts.o; then
- # 2.5.x.
- dagopts_obj=$dag_lib_dir/dagopts.o
- elif test -r $dag_lib_dir/libdag.a; then
- # 2.5.x.
- ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null
- if test -r ./dagopts.o; then
- dagopts_obj=./dagopts.o
- else
- ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null
- if test -r ./libdag_la-dagopts.o; then
- dagopts_obj=./libdag_la-dagopts.o
- fi
- fi
- fi
-
- if test $dagopts_obj = no; then
- { echo "$as_me:$LINENO: result: no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&5
-echo "${ECHO_T}no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)" >&6; }
- ac_cv_lbl_dag_api=no
- else
- { echo "$as_me:$LINENO: result: yes ($dagopts_obj)" >&5
-echo "${ECHO_T}yes ($dagopts_obj)" >&6; }
- fi
-fi
-
-if test $ac_cv_lbl_dag_api = yes; then
- # Under 2.5.x only we need to add dagreg.o.
- if test -r $dag_include_dir/dagreg.h; then
- { echo "$as_me:$LINENO: checking dagreg.o" >&5
-echo $ECHO_N "checking dagreg.o... $ECHO_C" >&6; }
- dagreg_obj=no
- if test -r $dag_lib_dir/dagreg.o; then
- # Object file is ready and waiting.
- dagreg_obj=$dag_lib_dir/dagreg.o
- elif test -r $dag_lib_dir/libdag.a; then
- # Extract from libdag.a.
- ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null
- if test -r ./dagreg.o; then
- dagreg_obj=./dagreg.o
- else
- ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null
- if test -r ./libdag_la-dagreg.o; then
- dagreg_obj=./libdag_la-dagreg.o
- fi
- fi
- fi
-
- if test $dagreg_obj = no; then
- { echo "$as_me:$LINENO: result: no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&5
-echo "${ECHO_T}no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&6; }
- ac_cv_lbl_dag_api=no
- else
- { echo "$as_me:$LINENO: result: yes ($dagreg_obj)" >&5
-echo "${ECHO_T}yes ($dagreg_obj)" >&6; }
- fi
- fi
-fi
-
-if test $ac_cv_lbl_dag_api = yes; then
- # Under 2.5.x only we need to add dagutil.o.
- if test -r $dag_include_dir/dagutil.h; then
- { echo "$as_me:$LINENO: checking dagutil.o" >&5
-echo $ECHO_N "checking dagutil.o... $ECHO_C" >&6; }
- dagutil_obj=no
- if test -r $dag_lib_dir/dagutil.o; then
- # Object file is ready and waiting.
- dagutil_obj=$dag_lib_dir/dagutil.o
- elif test -r $dag_lib_dir/libdag.a; then
- # Extract from libdag.a.
- ar x $dag_lib_dir/libdag.a dagutil.o 2>/dev/null
- if test -r ./dagutil.o; then
- dagutil_obj=./dagutil.o
- else
- ar x $dag_lib_dir/libdag.a libdag_la-dagutil.o 2>/dev/null
- if test -r ./libdag_la-dagutil.o; then
- dagutil_obj=./libdag_la-dagutil.o
- fi
- fi
- fi
-
- if test $dagutil_obj = no; then
- { echo "$as_me:$LINENO: result: no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&5
-echo "${ECHO_T}no (checked $dag_lib_dir $dag_lib_dir/libdag.a)" >&6; }
- ac_cv_lbl_dag_api=no
- else
- { echo "$as_me:$LINENO: result: yes ($dagutil_obj)" >&5
-echo "${ECHO_T}yes ($dagutil_obj)" >&6; }
- fi
- fi
-fi
-
if test $ac_cv_lbl_dag_api = yes; then
V_INCLS="$V_INCLS -I$dag_include_dir"
- ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $dagapi_obj $dagopts_obj $dagreg_obj $dagutil_obj"
+
if test $V_PCAP != dag ; then
SSRC="pcap-dag.c"
fi
fi
- LDFLAGS=$saved_ldflags
if test "$dag_streams" = 1; then
_ACEOF
LIBS="$LIBS -ldag"
+
+ { echo "$as_me:$LINENO: checking for vdag_set_device_info in -lvdag" >&5
+echo $ECHO_N "checking for vdag_set_device_info in -lvdag... $ECHO_C" >&6; }
+if test "${ac_cv_lib_vdag_vdag_set_device_info+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvdag $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char vdag_set_device_info ();
+int
+main ()
+{
+return vdag_set_device_info ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_vdag_vdag_set_device_info=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_vdag_vdag_set_device_info=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_vdag_vdag_set_device_info" >&5
+echo "${ECHO_T}$ac_cv_lib_vdag_vdag_set_device_info" >&6; }
+if test $ac_cv_lib_vdag_vdag_set_device_info = yes; then
+ ac_dag_have_vdag="1"
+else
+ ac_dag_have_vdag="0"
+fi
+
+ if test "$ac_dag_have_vdag" = 1; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DAG_VDAG 1
+_ACEOF
+
+ LIBS="$LIBS -lpthread"
+ fi
fi
+ LDFLAGS=$saved_ldflags
+
cat >>confdefs.h <<\_ACEOF
#define HAVE_DAG_API 1
case DLT_JUNIPER_VS:
case DLT_JUNIPER_SRX_E2E:
case DLT_JUNIPER_FIBRECHANNEL:
+ case DLT_JUNIPER_ATM_CEMIC:
off_linktype = 8;
off_macpl = -1;
off_nl = -1;
case DLT_JUNIPER_VS:
case DLT_JUNIPER_SRX_E2E:
case DLT_JUNIPER_FIBRECHANNEL:
+ case DLT_JUNIPER_ATM_CEMIC:
/* just lets verify the magic number for now -
* on ATM we may have up to 6 different encapsulations on the wire
case DLT_JUNIPER_VS:
case DLT_JUNIPER_SRX_E2E:
case DLT_JUNIPER_FIBRECHANNEL:
+ case DLT_JUNIPER_ATM_CEMIC:
/* juniper flags (including direction) are stored
* the byte after the 3-byte magic number */
pcap_t *p;
pcap_if_t *curdev, *prevdev, *nextdev;
int this_instance;
+ char open_errbuf[PCAP_ERRBUF_SIZE];
/*
* Is there already an entry in the list for this interface?
}
strcpy(en_name, "en");
strcat(en_name, name + 3);
- p = pcap_open_live(en_name, 68, 0, 0, errbuf);
+ p = pcap_open_live(en_name, 68, 0, 0, open_errbuf);
free(en_name);
} else
#endif /* __APPLE */
- p = pcap_open_live(name, 68, 0, 0, errbuf);
+ p = pcap_open_live(name, 68, 0, 0, open_errbuf);
if (p == NULL) {
/*
* No. Don't bother including it.
#define LINKTYPE_PRONET DLT_PRONET
#define LINKTYPE_CHAOS DLT_CHAOS
#define LINKTYPE_TOKEN_RING DLT_IEEE802 /* DLT_IEEE802 is used for Token Ring */
-#define LINKTYPE_ARCNET DLT_ARCNET /* BSD-style headers */
+#define LINKTYPE_ARCNET_BSD DLT_ARCNET /* BSD-style headers */
#define LINKTYPE_SLIP DLT_SLIP
#define LINKTYPE_PPP DLT_PPP
#define LINKTYPE_FDDI DLT_FDDI
#define LINKTYPE_JUNIPER_SRX_E2E 233
#define LINKTYPE_JUNIPER_FIBRECHANNEL 234
+/*
+ * DVB-CI (DVB Common Interface for communication between a PC Card
+ * module and a DVB receiver). See
+ *
+ * http://www.kaiser.cx/pcap-dvbci.html
+ *
+ * for the specification.
+ *
+ */
+#define LINKTYPE_DVB_CI 235
+
+/*
+ * Variant of 3GPP TS 27.010 multiplexing protocol. Requested
+ */
+#define LINKTYPE_MUX27010 236
+
+/*
+ * STANAG 5066 D_PDUs. Requested by M. Baris Demiray
+ */
+#define LINKTYPE_STANAG_5066_D_PDU 237
+
+/*
+ * Juniper-private data link type, as per request from
+ */
+#define LINKTYPE_JUNIPER_ATM_CEMIC 238
+
static struct linktype_map {
int dlt;
int linktype;
{ DLT_PRONET, LINKTYPE_PRONET },
{ DLT_CHAOS, LINKTYPE_CHAOS },
{ DLT_IEEE802, LINKTYPE_TOKEN_RING },
- { DLT_ARCNET, LINKTYPE_ARCNET },
+ { DLT_ARCNET, LINKTYPE_ARCNET_BSD },
{ DLT_SLIP, LINKTYPE_SLIP },
{ DLT_PPP, LINKTYPE_PPP },
{ DLT_FDDI, LINKTYPE_FDDI },
/* Juniper Fibrechannel */
{ DLT_JUNIPER_FIBRECHANNEL, LINKTYPE_JUNIPER_FIBRECHANNEL },
+ /* DVB-CI */
+ { DLT_DVB_CI, LINKTYPE_DVB_CI },
+
+ /* Variant of 3GPP TS 27.010 */
+ { DLT_MUX27010, LINKTYPE_MUX27010 },
+
+ /* STANAG 5066 D_PDUs */
+ { DLT_STANAG_5066_D_PDU, LINKTYPE_STANAG_5066_D_PDU },
+
+ /* Juniper ATM CE MIC */
+ { DLT_JUNIPER_ATM_CEMIC, LINKTYPE_JUNIPER_ATM_CEMIC },
+
{ -1, -1 }
};
The names for those values begin with
.BR LINKTYPE_ .
.PP
-The link-layer header types supported by libpcap are listed here. The
-value corresponding to
-.B LINKTYPE_
-names are given; the value corresponding to
-.B DLT_
-values are, in some cases, platform dependent, and are not given;
-applications should check for particular
-.B DLT_
-values by name.
-.RS 5
-.TP 5
-.BR DLT_NULL "; " LINKTYPE_NULL = 0
-BSD loopback encapsulation; the link-layer header is a 4-byte field, in
-.I host
-byte order, containing a PF_ value from
-.B socket.h
-for the network-layer protocol of the packet.
-.IP
-Note that ``host byte order'' is the byte order of the machine on which
-the packets are captured, and the PF_ values are for the OS of the
-machine on which the packets are captured; if a live capture is being
-done, ``host byte order'' is the byte order of the machine capturing the
-packets, and the PF_ values are those of the OS of the machine capturing
-the packets, but if a ``savefile'' is being read, the byte order and PF_
-values are
-.I not
-necessarily those of the machine reading the capture file.
-.TP 5
-.BR DLT_EN10MB "; " LINKTYPE_ETHERNET = 1
-Ethernet (10Mb, 100Mb, 1000Mb, and up); the
-.B 10MB
-in the
-.B DLT_
-name is historical.
-.TP 5
-.BR DLT_IEEE802 "; " LINKTYPE_TOKEN_RING = 6
-IEEE 802.5 Token Ring; the
-.B IEEE802
-in the
-.B DLT_
-name is historical.
-.TP 5
-.BR DLT_ARCNET "; " LINKTYPE_ARCNET = 7
-ARCNET
-.TP 5
-.BR DLT_SLIP "; " LINKTYPE_SLIP = 8
-SLIP; the link-layer header contains, in order:
-.RS 10
-.LP
-a 1-byte flag, which is 0 for packets received by the machine and 1 for
-packets sent by the machine;
-.LP
-a 1-byte field, the upper 4 bits of which indicate the type of packet,
-as per RFC 1144:
-.RS 5
-.TP 5
-0x40
-an unmodified IP datagram (TYPE_IP);
-.TP 5
-0x70
-an uncompressed-TCP IP datagram (UNCOMPRESSED_TCP), with that byte being
-the first byte of the raw IP header on the wire, containing the
-connection number in the protocol field;
-.TP 5
-0x80
-a compressed-TCP IP datagram (COMPRESSED_TCP), with that byte being the
-first byte of the compressed TCP/IP datagram header;
-.RE
-.LP
-for UNCOMPRESSED_TCP, the rest of the modified IP header, and for
-COMPRESSED_TCP, the compressed TCP/IP datagram header;
-.RE
-.RS 5
-.LP
-for a total of 16 bytes; the uncompressed IP datagram follows the header.
-.RE
-.TP 5
-.BR DLT_PPP "; " LINKTYPE_PPP = 9
-PPP; if the first 2 bytes are 0xff and 0x03, it's PPP in HDLC-like
-framing, with the PPP header following those two bytes, otherwise it's
-PPP without framing, and the packet begins with the PPP header.
-.TP 5
-.BR DLT_FDDI "; " LINKTYPE_FDDI = 10
-FDDI
-.TP 5
-.BR DLT_ATM_RFC1483 "; " LINKTYPE_ATM_RFC1483 = 100
-RFC 1483 LLC/SNAP-encapsulated ATM; the packet begins with an IEEE 802.2
-LLC header.
-.TP 5
-.BR DLT_RAW "; " LINKTYPE_RAW = 101
-raw IP; the packet begins with an IP header.
-.TP 5
-.BR DLT_PPP_SERIAL "; " LINKTYPE_PPP_HDLC = 50
-PPP in HDLC-like framing, as per RFC 1662, or Cisco PPP with HDLC
-framing, as per section 4.3.1 of RFC 1547; the first byte will be 0xFF
-for PPP in HDLC-like framing, and will be 0x0F or 0x8F for Cisco PPP
-with HDLC framing.
-.TP 5
-.BR DLT_PPP_ETHER "; " LINKTYPE_PPP_ETHER = 51
-PPPoE; the packet begins with a PPPoE header, as per RFC 2516.
-.TP 5
-.BR DLT_C_HDLC "; " LINKTYPE_C_HDLC = 104
-Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547.
-.TP 5
-.BR DLT_IEEE802_11 "; " LINKTYPE_IEEE802_11 = 105
-IEEE 802.11 wireless LAN
-.TP 5
-.BR DLT_FRELAY "; " LINKTYPE_FRELAY = 107
-Frame Relay
-.TP 5
-.BR DLT_LOOP "; " LINKTYPE_LOOP = 108
-OpenBSD loopback encapsulation; the link-layer header is a 4-byte field, in
-.I network
-byte order, containing a PF_ value from OpenBSD's
-.B socket.h
-for the network-layer protocol of the packet.
-.IP
-Note that, if a ``savefile'' is being read, those PF_ values are
-.I not
-necessarily those of the machine reading the capture file.
-.TP 5
-.BR DLT_LINUX_SLL "; " LINKTYPE_LINUX_SLL = 113
-Linux "cooked" capture encapsulation; the link-layer header contains, in
-order:
-.RS 10
-.LP
-a 2-byte "packet type", in network byte order, which is one of:
-.RS 5
-.TP 5
-0
-packet was sent to us by somebody else
-.TP 5
-1
-packet was broadcast by somebody else
-.TP 5
-2
-packet was multicast, but not broadcast, by somebody else
-.TP 5
-3
-packet was sent by somebody else to somebody else
-.TP 5
-4
-packet was sent by us
-.RE
-.LP
-a 2-byte field, in network byte order, containing a Linux ARPHRD_ value
-for the link-layer device type;
-.LP
-a 2-byte field, in network byte order, containing the length of the
-link-layer address of the sender of the packet (which could be 0);
-.LP
-an 8-byte field containing that number of bytes of the link-layer
-address of the sender (if there are more than 8 bytes, only the first
-8 are present, and if there are fewer than 8 bytes, there are padding
-bytes after the address to pad the field to 8 bytes);
-.LP
-a 2-byte field containing an Ethernet protocol type, in network byte
-order, or containing 1 for Novell 802.3 frames without an 802.2 LLC
-header or 4 for frames beginning with an 802.2 LLC header.
-.RE
-.TP 5
-.BR DLT_LTALK "; " LINKTYPE_LTALK = 104
-Apple LocalTalk; the packet begins with an AppleTalk LLAP header.
-.TP 5
-.BR DLT_PFLOG "; " LINKTYPE_PFLOG = 117
-OpenBSD pflog; the link-layer header contains a
-.B "struct pfloghdr"
-structure, as defined by the host on which the file was saved. (This
-differs from operating system to operating system and release to
-release; there is nothing in the file to indicate what the layout of
-that structure is.)
-.TP 5
-.BR DLT_PRISM_HEADER "; " LINKTYPE_PRISM_HEADER = 119
-Prism monitor mode information followed by an 802.11 header.
-.TP 5
-.BR DLT_IP_OVER_FC "; " LINKTYPE_IP_OVER_FC = 122
-RFC 2625 IP-over-Fibre Channel, with the link-layer header being the
-Network_Header as described in that RFC.
-.TP 5
-.BR DLT_SUNATM "; " LINKTYPE_SUNATM = 123
-SunATM devices; the link-layer header contains, in order:
-.RS 10
-.LP
-a 1-byte flag field, containing a direction flag in the uppermost bit,
-which is set for packets transmitted by the machine and clear for
-packets received by the machine, and a 4-byte traffic type in the
-low-order 4 bits, which is one of:
-.RS 5
-.TP 5
-0
-raw traffic
-.TP 5
-1
-LANE traffic
-.TP 5
-2
-LLC-encapsulated traffic
-.TP 5
-3
-MARS traffic
-.TP 5
-4
-IFMP traffic
-.TP 5
-5
-ILMI traffic
-.TP 5
-6
-Q.2931 traffic
-.RE
-.LP
-a 1-byte VPI value;
-.LP
-a 2-byte VCI field, in network byte order.
-.RE
-.TP 5
-.BR DLT_IEEE802_11_RADIO "; " LINKTYPE_IEEE802_11_RADIO = 127
-link-layer information followed by an 802.11 header - see
-http://www.shaftnet.org/~pizza/software/capturefrm.txt for a description
-of the link-layer information.
-.TP 5
-.BR DLT_ARCNET_LINUX "; " LINKTYPE_ARCNET_LINUX = 129
-ARCNET, with no exception frames, reassembled packets rather than raw
-frames, and an extra 16-bit offset field between the destination host
-and type bytes.
-.TP 5
-.BR DLT_LINUX_IRDA "; " LINKTYPE_LINUX_IRDA = 144
-Linux-IrDA packets, with a
-.B DLT_LINUX_SLL
-header followed by the IrLAP header.
-.TP 5
-.BR DLT_LINUX_LAPD "; " LINKTYPE_LINUX_LAPD = 177
-LAPD (Q.921) frames, with a
-.B DLT_LINUX_SLL
-header captured via vISDN.
-.RE
+The link-layer header types supported by libpcap are described at
+http://www.tcpdump.org/linktypes.html.
.SH SEE ALSO
pcap_datalink(3PCAP)
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
+ (void)closedir(sys_class_net_d);
return (-1);
}
if (fd < 0) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"socket: %s", pcap_strerror(errno));
+ (void)fclose(proc_net_f);
return (-1);
}
{
unsigned i, j, frames_per_block;
struct tpacket_req req;
+ socklen_t len;
+ unsigned int sk_type, tp_reserve, maclen, tp_hdrlen, netoff, macoff;
/*
* Start out assuming no warnings or errors.
* (and a lot of memory will be unused).
* The snap len should be carefully chosen to achive best
* performance */
- req.tp_frame_size = TPACKET_ALIGN(handle->snapshot +
- TPACKET_ALIGN(handle->md.tp_hdrlen) +
- sizeof(struct sockaddr_ll));
+
+ /* NOTE: calculus matching those in tpacket_rcv()
+ * in linux-2.6/net/packet/af_packet.c
+ */
+ len = sizeof(sk_type);
+ if (getsockopt(handle->fd, SOL_SOCKET, SO_TYPE, &sk_type, &len) < 0) {
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", pcap_strerror(errno));
+ *status = PCAP_ERROR;
+ return -1;
+ }
+ len = sizeof(tp_reserve);
+ if (getsockopt(handle->fd, SOL_PACKET, PACKET_RESERVE, &tp_reserve, &len) < 0) {
+ snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", pcap_strerror(errno));
+ *status = PCAP_ERROR;
+ return -1;
+ }
+ maclen = (sk_type == SOCK_DGRAM) ? 0 : MAX_LINKHEADER_SIZE;
+ /* XXX: in the kernel maclen is calculated from
+ * LL_ALLOCATED_SPACE(dev) and vnet_hdr.hdr_len
+ * in: packet_snd() in linux-2.6/net/packet/af_packet.c
+ * then packet_alloc_skb() in linux-2.6/net/packet/af_packet.c
+ * then sock_alloc_send_pskb() in linux-2.6/net/core/sock.c
+ * but I see no way to get those sizes in userspace,
+ * like for instance with an ifreq ioctl();
+ * the best thing I've found so far is MAX_HEADER in the kernel
+ * part of linux-2.6/include/linux/netdevice.h
+ * which goes up to 128+48=176; since pcap-linux.c defines
+ * a MAX_LINKHEADER_SIZE of 256 which is greater than that,
+ * let's use it.. maybe is it even large enough to directly
+ * replace macoff..
+ */
+ tp_hdrlen = TPACKET_ALIGN(handle->md.tp_hdrlen) + sizeof(struct sockaddr_ll) ;
+ netoff = TPACKET_ALIGN(tp_hdrlen + (maclen < 16 ? 16 : maclen)) + tp_reserve;
+ /* NOTE: AFAICS tp_reserve may break the TPACKET_ALIGN of
+ * netoff, which contradicts
+ * linux-2.6/Documentation/networking/packet_mmap.txt
+ * documenting that:
+ * "- Gap, chosen so that packet data (Start+tp_net)
+ * aligns to TPACKET_ALIGNMENT=16"
+ */
+ /* NOTE: in linux-2.6/include/linux/skbuff.h:
+ * "CPUs often take a performance hit
+ * when accessing unaligned memory locations"
+ */
+ macoff = netoff - maclen;
+ req.tp_frame_size = TPACKET_ALIGN(macoff + handle->snapshot);
req.tp_frame_nr = handle->opt.buffer_size/req.tp_frame_size;
/* compute the minumum block size that will handle this frame.
DLT_CHOICE(DLT_JUNIPER_VS, "Juniper Virtual Server"),
DLT_CHOICE(DLT_JUNIPER_SRX_E2E, "Juniper SRX E2E"),
DLT_CHOICE(DLT_JUNIPER_FIBRECHANNEL, "Juniper Fibrechannel"),
+ DLT_CHOICE(DLT_DVB_CI, "DVB-CI"),
+ DLT_CHOICE(DLT_JUNIPER_ATM_CEMIC, "Juniper ATM CEMIC"),
DLT_CHOICE_SENTINEL
};
};
/*
- * Data-link level type codes.
+ * Link-layer header type codes.
*
* Do *NOT* add new values to this list without asking
* being able to handle captures with your new DLT_ value, with no hope
* that they will ever be changed to do so (as that would destroy their
* ability to read captures using that value for that other purpose).
+ *
+ * See
+ *
+ * http://www.tcpdump.org/linktypes.html
+ *
+ * for detailed descriptions of some of these link-layer header types.
*/
/*
#define DLT_JUNIPER_SRX_E2E 233
#define DLT_JUNIPER_FIBRECHANNEL 234
+/*
+ * DVB-CI (DVB Common Interface for communication between a PC Card
+ * module and a DVB receiver). See
+ *
+ * http://www.kaiser.cx/pcap-dvbci.html
+ *
+ * for the specification.
+ *
+ */
+#define DLT_DVB_CI 235
+
+/*
+ * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but
+ * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel
+ */
+#define DLT_MUX27010 236
+
+/*
+ * STANAG 5066 D_PDUs. Requested by M. Baris Demiray
+ */
+#define DLT_STANAG_5066_D_PDU 237
+
+/*
+ * Juniper-private data link type, as per request from
+ */
+#define DLT_JUNIPER_ATM_CEMIC 238
+
/*
* DLT and savefile link type values are split into a class and
* a member of that class. A class value of 0 indicates a regular
being captured isn't known to the program, or if packets are being
captured on the Linux "any" pseudo-interface that can capture on more
than one network, a value of PCAP_NETMASK_UNKNOWN can be supplied; tests
-for IPv4 broadcast addreses will fail to compile, but all other tests in
+for IPv4 broadcast addresses will fail to compile, but all other tests in
the filter program will be OK.
.SH RETURN VALUE
.B pcap_compile()
(Note that there may be network devices that cannot be opened by the
process calling
.BR pcap_findalldevs() ,
-because, for example, that process might not have sufficient privileges
+because, for example, that process does not have sufficient privileges
to open them for capturing; if so, those devices will not appear on the
list.)
+If
+.B pcap_findalldevs()
+succeeds, the pointer pointed to by
.I alldevsp
-is set to point to the first element of the list; each element of the
-list is of type
+is set to point to the first element of the list, or to
+.B NULL
+if no devices were found (this is considered success).
+Each element of the list is of type
.BR pcap_if_t ,
and has the following members:
.RS
a pointer to a string giving a human-readable description of the device
.TP
.B addresses
-a pointer to the first element of a list of addresses for the interface
+a pointer to the first element of a list of network addresses for the
+device,
+or
+.B NULL
+if the device has no addresses
.TP
.B flags
-interface flags:
+device flags:
.RS
.TP
.B PCAP_IF_LOOPBACK
-set if the interface is a loopback interface
+set if the device is a loopback interface
.RE
.RE
.PP
that contains the broadcast address corresponding to the address pointed
to by
.BR addr ;
-may be null if the interface doesn't support broadcasts
+may be null if the device doesn't support broadcasts
.TP
.B dstaddr
if not
that contains the destination address corresponding to the address pointed
to by
.BR addr ;
-may be null if the interface isn't a point-to-point interface
+may be null if the device isn't a point-to-point interface
.RE
.PP
Note that not all the addresses in the list of addresses are
.IR alldevs .
.SH RETURN VALUE
.B pcap_findalldevs()
-returns 0 on success and \-1 on failure.
+returns 0 on success and \-1 on failure; as indicated, finding no
+devices is considered success, rather than failure, so 0 will be
+returned in that case.
If \-1 is returned,
.I errbuf
is filled in with an appropriate error message.
.B pcap_next()
returns a pointer to the packet data on success, and returns
.B NULL
-if an error occured, or if no packets were read from a live
+if an error occurred, or if no packets were read from a live
capture (if, for example, they were discarded because they didn't pass
the packet filter, or if, on platforms that support a read timeout that
starts before any packets arrive, the timeout expires before any packets
arrive, or if the file descriptor for the capture device is in
non-blocking mode and no packets were available to be read), or if no
more packets are available in a ``savefile.'' Unfortunately, there is
-no way to determine whether an error occured or not.
+no way to determine whether an error occurred or not.
.SH SEE ALSO
pcap(3PCAP), pcap_geterr(3PCAP), pcap_dispatch(3PCAP)
.I errbuf
may also be set to warning text when
.B pcap_open_live()
-succeds; to detect this case the caller should store a zero-length string in
+succeeds; to detect this case the caller should store a zero-length string in
.I errbuf
before calling
.B pcap_open_live()