Ignore:
Timestamp:
09/29/06 15:05:12 (15 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
6758276
Parents:
40d0efc
Message:

Fix some endianness issues (incomplete)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/link_wireless.c

    r5696294 r273a08e  
    5656        /* Check if the field exists in the radiotap header before proceeding
    5757        */
    58         if ((rtap->it_present & (1 << field)) == 0) return NULL;
     58        if ((bswap_le_to_host32(rtap->it_present) & (1 << field)) == 0) return NULL;
    5959
    6060        /* Skip over any extended bitmasks */
    6161        p = (uint8_t *) &(rtap->it_present);
    6262
    63         while ( *((uint32_t*)p) & (1 << TRACE_RADIOTAP_EXT) ) {
     63        while ( bswap_le_to_host32(*((uint32_t*)p)) & (1 << TRACE_RADIOTAP_EXT) ) {
    6464                p += sizeof (uint32_t);
    6565        }
     
    7474                /* Always aligned */
    7575                return (void*)p;
    76         if (rtap->it_present & (1 << TRACE_RADIOTAP_TSFT))
     76        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_TSFT))
    7777                p += sizeof (uint64_t);
    7878
     
    8080                /* Always aligned */
    8181                return (void*)p;
    82         if (rtap->it_present & (1 << TRACE_RADIOTAP_FLAGS))
     82        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_FLAGS))
    8383                p += sizeof (uint8_t);
    8484
     
    8686                /* Always aligned */
    8787                return (void*)p;
    88         if (rtap->it_present & (1 << TRACE_RADIOTAP_RATE))
     88        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_RATE))
    8989                p+= sizeof (uint8_t);
    9090
     
    9494                return (void *)p;
    9595        }
    96         if (rtap->it_present & (1 << TRACE_RADIOTAP_CHANNEL))
     96        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_CHANNEL))
    9797                p+= sizeof (uint32_t);
    9898
     
    102102                return (void *)p;
    103103        }
    104         if (rtap->it_present & (1 << TRACE_RADIOTAP_FHSS))
     104        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_FHSS))
    105105                p+= sizeof (uint16_t);
    106106
    107107        if (field == TRACE_RADIOTAP_DBM_ANTSIGNAL)
    108108                return (void *)p;
    109         if (rtap->it_present & (1 << TRACE_RADIOTAP_DBM_ANTSIGNAL))
     109        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DBM_ANTSIGNAL))
    110110                p+= sizeof (uint8_t);
    111111
    112112        if (field == TRACE_RADIOTAP_DBM_ANTNOISE)
    113113                return (void *)p;
    114         if (rtap->it_present & (1 << TRACE_RADIOTAP_DBM_ANTNOISE))
     114        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DBM_ANTNOISE))
    115115                p+= sizeof (uint8_t);
    116116
     
    120120                return (void *)p;
    121121        }
    122         if (rtap->it_present & (1 << TRACE_RADIOTAP_LOCK_QUALITY))
     122        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_LOCK_QUALITY))
    123123                p+= sizeof (uint16_t);
    124124
     
    128128                return (void *)p;
    129129        }
    130         if (rtap->it_present & (1 << TRACE_RADIOTAP_TX_ATTENUATION))
     130        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_TX_ATTENUATION))
    131131                p+= sizeof (uint16_t);
    132132
     
    136136                return (void *)p;
    137137        }
    138         if (rtap->it_present & (1 << TRACE_RADIOTAP_DB_TX_ATTENUATION))
     138        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DB_TX_ATTENUATION))
    139139                p+= sizeof (uint16_t);
    140140
    141141        if (field == TRACE_RADIOTAP_DBM_TX_POWER)
    142142                return (void *)p;
    143         if (rtap->it_present & (1 << TRACE_RADIOTAP_DBM_TX_POWER))
     143        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DBM_TX_POWER))
    144144                p+= sizeof (uint8_t);
    145145
    146146        if (field == TRACE_RADIOTAP_ANTENNA)
    147147                return (void *)p;
    148         if (rtap->it_present & (1 << TRACE_RADIOTAP_ANTENNA))
     148        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_ANTENNA))
    149149                p+= sizeof (uint8_t);
    150150
    151151        if (field == TRACE_RADIOTAP_DB_ANTSIGNAL)
    152152                return (void *)p;
    153         if (rtap->it_present & (1 << TRACE_RADIOTAP_DB_ANTSIGNAL))
     153        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DB_ANTSIGNAL))
    154154                p+= sizeof (uint8_t);
    155155
    156156        if (field == TRACE_RADIOTAP_DB_ANTNOISE)
    157157                return (void *) p;
    158         if (rtap->it_present & (1 << TRACE_RADIOTAP_DB_ANTNOISE))
     158        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DB_ANTNOISE))
    159159                p+= sizeof (uint8_t);
    160160
Note: See TracChangeset for help on using the changeset viewer.