Ignore:
Timestamp:
05/20/16 14:55:03 (5 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
a984307, ccc598d
Parents:
e26c1fc
Message:

Fix alignment issues when dumping a RadioTap? header with extended presence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpacketdump/link_15.c

    r89aa13f r2b0eae9  
    1111#include "lt_bswap.h"
    1212
     13#define ALIGN_NATURAL_64(_p,_s,_c) \
     14        while ( (_p - _s) % sizeof(uint64_t)) {_p++; _c++;}
    1315#define ALIGN_NATURAL_32(_p,_s,_c) \
    1416        while ( (_p - _s) % sizeof(uint32_t)) {_p++; _c++;}
     
    5355        }
    5456
     57        if ( (rtap_pres) & (1 << TRACE_RADIOTAP_EXT) )
     58                printf("\n");
    5559
    5660        /* make p point to the first data field */
    57         s = p = (uint8_t *) ++ptr;
     61        s = (uint8_t *) rtap;
     62        p = (uint8_t *) ++ptr;
    5863
    5964        if (rtap_pres & (1 << TRACE_RADIOTAP_TSFT)) {
     65                ALIGN_NATURAL_64(p,s,rtap_real_len);
    6066                printf(" Radiotap: TSFT = %" PRIu64 " microseconds\n", bswap_le_to_host64(*((uint64_t *)p)));
    6167                p += sizeof (uint64_t);
Note: See TracChangeset for help on using the changeset viewer.