dect
/
libpcap
Archived
13
0
Fork 0

From Stephen Donnelly:

Clean up the configure output for the dag libraries a bit.

	Add Florent Drouin's changes for DLT_ERF.

	Some other DAG changes.
This commit is contained in:
guy 2007-10-30 10:16:45 +00:00
parent 149057f024
commit 877d5fc4eb
4 changed files with 3357 additions and 3601 deletions

6629
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.139 2007-10-20 01:15:14 guy Exp $ (LBL) dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.140 2007-10-30 10:16:45 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.
@ -6,7 +6,7 @@ dnl
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl dnl
AC_REVISION($Revision: 1.139 $) AC_REVISION($Revision: 1.140 $)
AC_PREREQ(2.50) AC_PREREQ(2.50)
AC_INIT(pcap.c) AC_INIT(pcap.c)
@ -505,11 +505,11 @@ if test $ac_cv_lbl_dag_api = yes; then
dagapi_obj=$dag_lib_dir/dagapi.o dagapi_obj=$dag_lib_dir/dagapi.o
elif test -r $dag_lib_dir/libdag.a; then elif test -r $dag_lib_dir/libdag.a; then
# 2.5.x. # 2.5.x.
ar x $dag_lib_dir/libdag.a dagapi.o ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null
if test -r ./dagapi.o; then if test -r ./dagapi.o; then
dagapi_obj=./dagapi.o dagapi_obj=./dagapi.o
else else
ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null
if test -r ./libdag_la-dagapi.o; then if test -r ./libdag_la-dagapi.o; then
dagapi_obj=./libdag_la-dagapi.o dagapi_obj=./libdag_la-dagapi.o
fi fi
@ -536,11 +536,11 @@ if test $ac_cv_lbl_dag_api = yes; then
dagopts_obj=$dag_lib_dir/dagopts.o dagopts_obj=$dag_lib_dir/dagopts.o
elif test -r $dag_lib_dir/libdag.a; then elif test -r $dag_lib_dir/libdag.a; then
# 2.5.x. # 2.5.x.
ar x $dag_lib_dir/libdag.a dagopts.o ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null
if test -r ./dagopts.o; then if test -r ./dagopts.o; then
dagopts_obj=./dagopts.o dagopts_obj=./dagopts.o
else else
ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null
if test -r ./libdag_la-dagopts.o; then if test -r ./libdag_la-dagopts.o; then
dagopts_obj=./libdag_la-dagopts.o dagopts_obj=./libdag_la-dagopts.o
fi fi
@ -565,11 +565,11 @@ if test $ac_cv_lbl_dag_api = yes; then
dagreg_obj=$dag_lib_dir/dagreg.o dagreg_obj=$dag_lib_dir/dagreg.o
elif test -r $dag_lib_dir/libdag.a; then elif test -r $dag_lib_dir/libdag.a; then
# Extract from libdag.a. # Extract from libdag.a.
ar x $dag_lib_dir/libdag.a dagreg.o ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null
if test -r ./dagreg.o; then if test -r ./dagreg.o; then
dagreg_obj=./dagreg.o dagreg_obj=./dagreg.o
else else
ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null
if test -r ./libdag_la-dagreg.o; then if test -r ./libdag_la-dagreg.o; then
dagreg_obj=./libdag_la-dagreg.o dagreg_obj=./libdag_la-dagreg.o
fi fi
@ -597,28 +597,25 @@ if test $ac_cv_lbl_dag_api = yes; then
# included if there's a found-action (arg 3). # included if there's a found-action (arg 3).
saved_ldflags=$LDFLAGS saved_ldflags=$LDFLAGS
LDFLAGS="-L$dag_lib_dir" LDFLAGS="-L$dag_lib_dir"
AC_CHECK_LIB([dag], [dag_attach_stream], [dag_version="2.5.x"], [dag_version="2.4.x"]) AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
AC_CHECK_LIB([dag],[dag_get_erf_types], [ AC_CHECK_LIB([dag],[dag_get_erf_types], [
AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])]) AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [ AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])]) AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
LDFLAGS=$saved_ldflags LDFLAGS=$saved_ldflags
if test "$dag_version" = 2.5.x; then if test "$dag_streams" = 1; 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])
DAGLIBS="-ldag" DAGLIBS="-ldag"
fi fi
# See if we can find a specific version string.
AC_MSG_CHECKING([the DAG API version])
if test -r "$dag_root/VERSION"; then
dag_version="`cat $dag_root/VERSION`"
fi
AC_MSG_RESULT([$dag_version])
AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
fi fi
AC_MSG_CHECKING(whether we have the DAG API)
if test $ac_cv_lbl_dag_api = no; then if test $ac_cv_lbl_dag_api = no; then
AC_MSG_RESULT(no)
if test "$want_dag" = yes; then if test "$want_dag" = yes; then
# User wanted DAG support but we couldn't find it. # User wanted DAG support but we couldn't find it.
AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag]) AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
@ -629,6 +626,8 @@ if test $ac_cv_lbl_dag_api = no; then
# found. # found.
AC_MSG_ERROR([Specifying the capture type as "dag" requires the DAG API to be present; use the --with-dag options to specify the location. (Try "./configure --help" for more information.)]) AC_MSG_ERROR([Specifying the capture type as "dag" requires the DAG API to be present; use the --with-dag options to specify the location. (Try "./configure --help" for more information.)])
fi fi
else
AC_MSG_RESULT(yes)
fi fi
AC_ARG_WITH(septel, [ --with-septel[[=DIR]] include Septel support (located in directory DIR, if supplied). [default=yes, on Linux, if present]], AC_ARG_WITH(septel, [ --with-septel[[=DIR]] include Septel support (located in directory DIR, if supplied). [default=yes, on Linux, if present]],

View File

@ -21,7 +21,7 @@
*/ */
#ifndef lint #ifndef lint
static const char rcsid[] _U_ = static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.291 2007-10-26 00:44:56 guy Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.292 2007-10-30 10:16:45 guy Exp $ (LBL)";
#endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -1290,6 +1290,17 @@ init_linktype(p)
off_nl_nosnap = -1; off_nl_nosnap = -1;
return; return;
case DLT_ERF:
off_li = 22;
off_sio = 23;
off_opc = 24;
off_dpc = 24;
off_sls = 27;
off_linktype = -1;
off_nl = -1;
off_nl_nosnap = -1;
return;
#ifdef DLT_PFSYNC #ifdef DLT_PFSYNC
case DLT_PFSYNC: case DLT_PFSYNC:
off_linktype = -1; off_linktype = -1;
@ -7183,6 +7194,7 @@ gen_mtp2type_abbrev(type)
case M_FISU: case M_FISU:
if ( (linktype != DLT_MTP2) && if ( (linktype != DLT_MTP2) &&
(linktype != DLT_ERF) &&
(linktype != DLT_MTP2_WITH_PHDR) ) (linktype != DLT_MTP2_WITH_PHDR) )
bpf_error("'fisu' supported only on MTP2"); bpf_error("'fisu' supported only on MTP2");
/* gen_ncmp(offrel, offset, size, mask, jtype, reverse, value) */ /* gen_ncmp(offrel, offset, size, mask, jtype, reverse, value) */
@ -7191,6 +7203,7 @@ gen_mtp2type_abbrev(type)
case M_LSSU: case M_LSSU:
if ( (linktype != DLT_MTP2) && if ( (linktype != DLT_MTP2) &&
(linktype != DLT_ERF) &&
(linktype != DLT_MTP2_WITH_PHDR) ) (linktype != DLT_MTP2_WITH_PHDR) )
bpf_error("'lssu' supported only on MTP2"); bpf_error("'lssu' supported only on MTP2");
b0 = gen_ncmp(OR_PACKET, off_li, BPF_B, 0x3f, BPF_JGT, 1, 2); b0 = gen_ncmp(OR_PACKET, off_li, BPF_B, 0x3f, BPF_JGT, 1, 2);
@ -7200,6 +7213,7 @@ gen_mtp2type_abbrev(type)
case M_MSU: case M_MSU:
if ( (linktype != DLT_MTP2) && if ( (linktype != DLT_MTP2) &&
(linktype != DLT_ERF) &&
(linktype != DLT_MTP2_WITH_PHDR) ) (linktype != DLT_MTP2_WITH_PHDR) )
bpf_error("'msu' supported only on MTP2"); bpf_error("'msu' supported only on MTP2");
b0 = gen_ncmp(OR_PACKET, off_li, BPF_B, 0x3f, BPF_JGT, 0, 2); b0 = gen_ncmp(OR_PACKET, off_li, BPF_B, 0x3f, BPF_JGT, 0, 2);

View File

@ -17,7 +17,7 @@
#ifndef lint #ifndef lint
static const char rcsid[] _U_ = static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.31 2007-10-04 23:06:25 guy Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.32 2007-10-30 10:16:45 guy Exp $ (LBL)";
#endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -257,7 +257,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
dag_record_t *header = (dag_record_t *)(p->md.dag_mem_base + p->md.dag_mem_bottom); dag_record_t *header = (dag_record_t *)(p->md.dag_mem_base + p->md.dag_mem_bottom);
#endif /* HAVE_DAG_STREAMS_API */ #endif /* HAVE_DAG_STREAMS_API */
u_char *dp = ((u_char *)header) + dag_record_size; u_char *dp = ((u_char *)header); /* + dag_record_size; */
unsigned short rlen; unsigned short rlen;
/* /*
@ -281,6 +281,44 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
} }
p->md.dag_mem_bottom += rlen; p->md.dag_mem_bottom += rlen;
/* ERF 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.
* 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.
* The packet length is
* 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
* pseudo header will be adjusted during the decoding,
* o plus the length of the optional subheader (if present).
*
* The capture length is header.rlen and the byte stuffing for alignment will be dropped
* if the capture length is greater than the packet length.
*/
if (p->linktype == DLT_ERF) {
packet_len = ntohs(header->wlen) + dag_record_size;
caplen = rlen;
switch (header->type) {
case TYPE_MC_AAL5:
case TYPE_MC_ATM:
case TYPE_MC_HDLC:
packet_len += 4; /* MC header */
break;
case TYPE_DSM_COLOR_ETH:
case TYPE_COLOR_ETH:
case TYPE_ETH:
packet_len += 2; /* ETH header */
break;
} /* switch type */
if (caplen > packet_len) {
caplen = packet_len;
}
} else {
/* Other kind of encapsulation according to the header Type */
dp += dag_record_size;
switch(header->type) { switch(header->type) {
case TYPE_ATM: case TYPE_ATM:
#ifdef TYPE_AAL5 #ifdef TYPE_AAL5
@ -390,7 +428,8 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
* Ignore rather than generating error * Ignore rather than generating error
*/ */
continue; continue;
} } /* switch type */
} /* ERF encapsulation */
if (caplen > p->snapshot) if (caplen > p->snapshot)
caplen = p->snapshot; caplen = p->snapshot;
@ -1034,6 +1073,7 @@ dag_get_datalink(pcap_t *p)
p->dlt_list[dlt_index++] = DLT_FRELAY; p->dlt_list[dlt_index++] = DLT_FRELAY;
p->dlt_list[dlt_index++] = DLT_MTP2; p->dlt_list[dlt_index++] = DLT_MTP2;
p->dlt_list[dlt_index++] = DLT_MTP2_WITH_PHDR; p->dlt_list[dlt_index++] = DLT_MTP2_WITH_PHDR;
p->dlt_list[dlt_index++] = DLT_LAPD;
} }
if(!p->linktype) if(!p->linktype)
p->linktype = DLT_CHDLC; p->linktype = DLT_CHDLC;
@ -1053,6 +1093,8 @@ dag_get_datalink(pcap_t *p)
index++; index++;
} }
p->dlt_list[dlt_index++] = DLT_ERF;
p->dlt_count = dlt_index; p->dlt_count = dlt_index;
return p->linktype; return p->linktype;