From 29efea32e81a97a21cc1b26245b3a34a25052f87 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 2 Feb 2011 17:38:27 +0100 Subject: cesar/tools/sniffer_phy: handle weird frame length, closes #2259 --- cesar/tools/sniffer_phy/src/lowlevel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cesar/tools') diff --git a/cesar/tools/sniffer_phy/src/lowlevel.c b/cesar/tools/sniffer_phy/src/lowlevel.c index 1b79f412f0..36383e9d05 100644 --- a/cesar/tools/sniffer_phy/src/lowlevel.c +++ b/cesar/tools/sniffer_phy/src/lowlevel.c @@ -90,8 +90,12 @@ lowlevel_fc_analyse (sniffer_phy_t *ctx, const u32 *fc_av, / symbol_tck[mpdu->tm->gil] + 2); /* Compute number of PB. */ uint bits_per_pb = mpdu->tm->bits_per_pb[PHY_PB_SIZE_520]; - mpdu->pb_nb = ((symb_nb - 1) * mpdu->tm->bits_per_symbol - + bits_per_pb) / bits_per_pb; + uint bits_per_symbol = mpdu->tm->bits_per_symbol; + if (bits_per_pb >= bits_per_symbol) + mpdu->pb_nb = symb_nb * bits_per_symbol / bits_per_pb; + else + mpdu->pb_nb = ((symb_nb - 1) * bits_per_symbol + + bits_per_pb) / bits_per_pb; } break; default: @@ -102,8 +106,9 @@ lowlevel_fc_analyse (sniffer_phy_t *ctx, const u32 *fc_av, if (mpdu->pb_nb) { uint bits_per_pb = mpdu->tm->bits_per_pb[mpdu->pb_size]; - mpdu->symbol_nb = (1 * bits_per_pb + mpdu->tm->bits_per_symbol - - 1) / mpdu->tm->bits_per_symbol; + uint bits_per_symbol = mpdu->tm->bits_per_symbol; + mpdu->symbol_nb = (mpdu->pb_nb * bits_per_pb + + bits_per_symbol - 1) / bits_per_symbol; } } } -- cgit v1.2.3