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
This commit is contained in:
Guy Harris 2012-10-12 20:51:04 +00:00
parent 58c859dd90
commit 10b89e0430
1 changed files with 3 additions and 2 deletions

View File

@ -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;