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:
parent
149057f024
commit
877d5fc4eb
31
configure.in
31
configure.in
|
@ -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]],
|
||||||
|
|
16
gencode.c
16
gencode.c
|
@ -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);
|
||||||
|
|
232
pcap-dag.c
232
pcap-dag.c
|
@ -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
|
||||||
|
@ -246,18 +246,18 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
||||||
|
|
||||||
/* Process the packets. */
|
/* Process the packets. */
|
||||||
while (p->md.dag_mem_top - p->md.dag_mem_bottom >= dag_record_size) {
|
while (p->md.dag_mem_top - p->md.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 *)(p->md.dag_mem_bottom);
|
dag_record_t *header = (dag_record_t *)(p->md.dag_mem_bottom);
|
||||||
#else
|
#else
|
||||||
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,117 +281,156 @@ 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;
|
||||||
|
|
||||||
switch(header->type) {
|
/* ERF encapsulation */
|
||||||
case TYPE_ATM:
|
/* The Extensible Record Format is not dropped for this kind of encapsulation,
|
||||||
#ifdef TYPE_AAL5
|
* and will be handled as a pseudo header by the decoding application.
|
||||||
case TYPE_AAL5:
|
* The information carried in the ERF header and in the optional subheader (if present)
|
||||||
if (header->type == TYPE_AAL5) {
|
* could be merged with the libpcap information, to offer a better decoding.
|
||||||
packet_len = ntohs(header->wlen);
|
* The packet length is
|
||||||
caplen = rlen - dag_record_size;
|
* 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) {
|
||||||
|
case TYPE_ATM:
|
||||||
|
#ifdef TYPE_AAL5
|
||||||
|
case TYPE_AAL5:
|
||||||
|
if (header->type == TYPE_AAL5) {
|
||||||
|
packet_len = ntohs(header->wlen);
|
||||||
|
caplen = rlen - dag_record_size;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef TYPE_MC_ATM
|
#ifdef TYPE_MC_ATM
|
||||||
case TYPE_MC_ATM:
|
case TYPE_MC_ATM:
|
||||||
if (header->type == TYPE_MC_ATM) {
|
if (header->type == TYPE_MC_ATM) {
|
||||||
caplen = packet_len = ATM_CELL_SIZE;
|
caplen = packet_len = ATM_CELL_SIZE;
|
||||||
dp+=4;
|
dp+=4;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef TYPE_MC_AAL5
|
#ifdef TYPE_MC_AAL5
|
||||||
case TYPE_MC_AAL5:
|
case TYPE_MC_AAL5:
|
||||||
if (header->type == TYPE_MC_AAL5) {
|
if (header->type == TYPE_MC_AAL5) {
|
||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
caplen = rlen - dag_record_size - 4;
|
caplen = rlen - dag_record_size - 4;
|
||||||
dp+=4;
|
dp+=4;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
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)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
packet_len -= ATM_HDR_SIZE;
|
packet_len -= ATM_HDR_SIZE;
|
||||||
caplen -= ATM_HDR_SIZE;
|
caplen -= ATM_HDR_SIZE;
|
||||||
dp += ATM_HDR_SIZE;
|
dp += ATM_HDR_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef TYPE_DSM_COLOR_ETH
|
#ifdef TYPE_DSM_COLOR_ETH
|
||||||
case TYPE_DSM_COLOR_ETH:
|
case TYPE_DSM_COLOR_ETH:
|
||||||
#endif
|
#endif
|
||||||
#ifdef TYPE_COLOR_ETH
|
#ifdef TYPE_COLOR_ETH
|
||||||
case TYPE_COLOR_ETH:
|
case TYPE_COLOR_ETH:
|
||||||
#endif
|
#endif
|
||||||
case TYPE_ETH:
|
case TYPE_ETH:
|
||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
packet_len -= (p->md.dag_fcs_bits >> 3);
|
packet_len -= (p->md.dag_fcs_bits >> 3);
|
||||||
caplen = rlen - dag_record_size - 2;
|
caplen = rlen - dag_record_size - 2;
|
||||||
if (caplen > packet_len) {
|
if (caplen > packet_len) {
|
||||||
caplen = packet_len;
|
caplen = packet_len;
|
||||||
}
|
}
|
||||||
dp += 2;
|
dp += 2;
|
||||||
break;
|
break;
|
||||||
#ifdef TYPE_DSM_COLOR_HDLC_POS
|
#ifdef TYPE_DSM_COLOR_HDLC_POS
|
||||||
case TYPE_DSM_COLOR_HDLC_POS:
|
case TYPE_DSM_COLOR_HDLC_POS:
|
||||||
#endif
|
#endif
|
||||||
#ifdef TYPE_COLOR_HDLC_POS
|
#ifdef TYPE_COLOR_HDLC_POS
|
||||||
case TYPE_COLOR_HDLC_POS:
|
case TYPE_COLOR_HDLC_POS:
|
||||||
#endif
|
#endif
|
||||||
case TYPE_HDLC_POS:
|
case TYPE_HDLC_POS:
|
||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
packet_len -= (p->md.dag_fcs_bits >> 3);
|
packet_len -= (p->md.dag_fcs_bits >> 3);
|
||||||
caplen = rlen - dag_record_size;
|
caplen = rlen - dag_record_size;
|
||||||
if (caplen > packet_len) {
|
if (caplen > packet_len) {
|
||||||
caplen = packet_len;
|
caplen = packet_len;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef TYPE_COLOR_MC_HDLC_POS
|
#ifdef TYPE_COLOR_MC_HDLC_POS
|
||||||
case TYPE_COLOR_MC_HDLC_POS:
|
case TYPE_COLOR_MC_HDLC_POS:
|
||||||
#endif
|
#endif
|
||||||
#ifdef TYPE_MC_HDLC
|
#ifdef TYPE_MC_HDLC
|
||||||
case TYPE_MC_HDLC:
|
case TYPE_MC_HDLC:
|
||||||
packet_len = ntohs(header->wlen);
|
packet_len = ntohs(header->wlen);
|
||||||
packet_len -= (p->md.dag_fcs_bits >> 3);
|
packet_len -= (p->md.dag_fcs_bits >> 3);
|
||||||
caplen = rlen - dag_record_size - 4;
|
caplen = rlen - dag_record_size - 4;
|
||||||
if (caplen > packet_len) {
|
if (caplen > packet_len) {
|
||||||
caplen = packet_len;
|
caplen = packet_len;
|
||||||
}
|
}
|
||||||
/* jump the MC_HDLC_HEADER */
|
/* jump the MC_HDLC_HEADER */
|
||||||
dp += 4;
|
dp += 4;
|
||||||
if (p->linktype == DLT_MTP2_WITH_PHDR) {
|
if (p->linktype == DLT_MTP2_WITH_PHDR) {
|
||||||
/* 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);
|
||||||
*(TempPkt+MTP2_LINK_NUMBER_OFFSET+1) = ((header->rec.mc_hdlc.mc_header>>24)&0xff);
|
*(TempPkt+MTP2_LINK_NUMBER_OFFSET+1) = ((header->rec.mc_hdlc.mc_header>>24)&0xff);
|
||||||
memcpy(TempPkt+MTP2_HDR_LEN, dp, caplen);
|
memcpy(TempPkt+MTP2_HDR_LEN, dp, caplen);
|
||||||
dp = TempPkt;
|
dp = TempPkt;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
/* Unhandled ERF type.
|
/* Unhandled ERF type.
|
||||||
* 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;
|
||||||
|
|
||||||
|
@ -431,10 +470,10 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
Reference in New Issue