From Jesper Peterson: fix a couple of endianness problems.
This commit is contained in:
parent
7ac8a0a75b
commit
1c186556cd
12
pcap-dag.c
12
pcap-dag.c
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] _U_ =
|
static const char rcsid[] _U_ =
|
||||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.16 2004-01-05 18:18:54 guy Exp $ (LBL)";
|
"@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.17 2004-01-30 02:23:53 guy Exp $ (LBL)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
@ -211,7 +211,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
||||||
}
|
}
|
||||||
|
|
||||||
p->md.dag_mem_top = dag_offset(p->fd, &(p->md.dag_mem_bottom), flags);
|
p->md.dag_mem_top = dag_offset(p->fd, &(p->md.dag_mem_bottom), flags);
|
||||||
if ((p->md.dag_mem_top - p->md.dag_mem_bottom < dag_record_size) && nonblocking)
|
if (nonblocking && (p->md.dag_mem_top - p->md.dag_mem_bottom < dag_record_size))
|
||||||
{
|
{
|
||||||
/* Pcap is configured to process only available packets, and there aren't any. */
|
/* Pcap is configured to process only available packets, and there aren't any. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -274,8 +274,8 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
||||||
}
|
}
|
||||||
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 == 5) ? 6 :
|
((sunatm->vpi == 0 && sunatm->vci == htons(5)) ? 6 :
|
||||||
((sunatm->vpi == 0 && sunatm->vci == 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)));
|
||||||
|
@ -320,10 +320,10 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
||||||
|
|
||||||
/* Count lost packets. */
|
/* Count lost packets. */
|
||||||
if (header->lctr) {
|
if (header->lctr) {
|
||||||
if (p->md.stat.ps_drop > (UINT_MAX - header->lctr)) {
|
if (p->md.stat.ps_drop > (UINT_MAX - ntohs(header->lctr))) {
|
||||||
p->md.stat.ps_drop = UINT_MAX;
|
p->md.stat.ps_drop = UINT_MAX;
|
||||||
} else {
|
} else {
|
||||||
p->md.stat.ps_drop += header->lctr;
|
p->md.stat.ps_drop += ntohs(header->lctr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue