[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dccp] Re: Revised tcpdump patch
Hi Ian,
There might be a bug in seqno and ackno printing in thr code.
Could you test the following patch?
Thanks,
--
Yoshifumi Nishida
nishida at csl.sony.co.jp
From: Ian McDonald <iam4 at cs.waikato.ac.nz>
Subject: Re: Revised tcpdump patch
Date: Mon, 05 Sep 2005 13:16:00 +1200
Message-ID: <431B9C50.1050905 at cs.waikato.ac.nz>
> Folks,
>
> There is a new revised version of the tcpdump patch now available linked from http://wlug.org.nz/DCCP
>
> Arnaldo found an issue with 64 bit big endian machines and gave me a revised patch.
>
> I am now about to submit to the tcpdump maintainers.
>
> Regards,
>
> Ian
>
> -
> To unsubscribe from this list: send the line "unsubscribe dccp" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--- tcpdump-2005.08.25/dccp.h 2005-09-13 01:53:10.000000000 +0900
+++ tcpdump-2005.08.25.dccp//dccp.h 2005-09-13 01:48:22.000000000 +0900
@@ -39,8 +39,7 @@ struct dccp_hdr {
#define DCCPH_X(dh) ((dh)->dccph_xtrs.dccph_xtr & 1)
#define DCCPH_TYPE(dh) (((dh)->dccph_xtrs.dccph_xtr >> 1) & 0xF)
-
-#define DCCPH_SEQ(dh) (((dh)->dccph_xtrs.dccph_seq >> 8) & 0x0FFF)
+#define DCCPH_SEQ(dh) (((dh)->dccph_xtrs.dccph_seq) >> 8)
/**
* struct dccp_hdr_ext - the low bits of a 48 bit seq packet
@@ -71,7 +70,7 @@ struct dccp_hdr_ack_bits {
u_int32_t dccph_ack_nr_low;
};
-#define DCCPH_ACK(dh_ack) (((dh_ack)->dccph_ra >> 8) & 0x0FFF)
+#define DCCPH_ACK(dh_ack) ((dh_ack)->dccph_ra >> 8)
/**
* struct dccp_hdr_response - Conection initiation response header
--- tcpdump-2005.08.25/print-dccp.c 2005-09-13 01:53:10.000000000 +0900
+++ tcpdump-2005.08.25.dccp/print-dccp.c 2005-09-13 01:48:02.000000000 +0900
@@ -137,12 +137,12 @@ static const char *dccp_reset_code(u_int
static u_int64_t dccp_seqno(const struct dccp_hdr *dh)
{
u_int32_t seq_high = DCCPH_SEQ(dh);
- u_int64_t seqno = EXTRACT_24BITS(&seq_high);
+ u_int64_t seqno = EXTRACT_24BITS(&seq_high) & 0xFFFFFF;
if (DCCPH_X(dh) != 0) {
const struct dccp_hdr_ext *dhx = (void *)dh + sizeof(*dh);
u_int32_t seq_low = dhx->dccph_seq_low;
-
+ seqno &= 0x00FFFF; /* clear reserved field */
seqno = (seqno << 32) + EXTRACT_32BITS(&seq_low);
}
@@ -153,11 +153,12 @@ static u_int64_t dccp_ack_no(const struc
const struct dccp_hdr_ack_bits *dh_ack)
{
u_int32_t ack_high = DCCPH_ACK(dh_ack);
- u_int64_t ackno = EXTRACT_24BITS(&ack_high);
+ u_int64_t ackno = EXTRACT_24BITS(&ack_high) & 0xFFFFFF;
if (DCCPH_X(dh) != 0) {
u_int32_t ack_low = dh_ack->dccph_ack_nr_low;
+ ackno &= 0x00FFFF; /* clear reserved field */
ackno = (ackno << 32) + EXTRACT_32BITS(&ack_low);
}