From 10b89e0430d1fbeb142fe816b49b9a691e4364c1 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 12 Oct 2012 20:51:04 +0000 Subject: [PATCH] The "rate" field in the CommView NCF format is 1 byte long, not 2 bytes long; that means we read only one byte into our structure, so make its "rate" element one byte long, so we don't fill in half the "rate" element with the read - and the *wrong* half on big-endian machines - and leave the other half un-set and thus containing some random possibly non-zero data. In addition, that's not the full data rate for faster networks; for Wi-Fi, the one-byte "direction" field is actually the upper 8 bits of the data rate, so combine them when we fill in the data rate in the pseudo-header. #BACKPORT svn path=/trunk/; revision=45504 --- wiretap/commview.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wiretap/commview.c b/wiretap/commview.c index fb97f3d2eb..ca187ac79e 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -57,7 +57,7 @@ typedef struct commview_header { guint32 usecs; guint8 flags; /* Bit-field positions defined below */ guint8 signal_level_percent; - guint16 rate; + guint8 rate; guint8 band; guint8 channel; guint8 direction; /* Or for WiFi, high order byte of @@ -143,7 +143,8 @@ commview_set_pseudo_header(commview_header_t *cv_hdrp, union wtap_pseudo_header pseudo_header->ieee_802_11.fcs_len = -1; /* Unknown */ pseudo_header->ieee_802_11.decrypted = FALSE; pseudo_header->ieee_802_11.channel = cv_hdrp->channel; - pseudo_header->ieee_802_11.data_rate = cv_hdrp->rate; + pseudo_header->ieee_802_11.data_rate = + cv_hdrp->rate | (cv_hdrp->direction << 8); pseudo_header->ieee_802_11.signal_level = cv_hdrp->signal_level_percent; break;