Changeset f0c639b for lib


Ignore:
Timestamp:
03/26/07 11:47:31 (15 years ago)
Author:
Scott Raynel <smr26@…>
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:
38f9537
Parents:
be22b51
Message:
  • Remove trace_get_wireless_fcs as it is no longer part of the Radiotap standard.
  • Update trace_get_wire_length to account for the presence (or absence) of FCS bytes at the end of wireless frames. (only pcap and pcapfile for now)
  • Update radiotap libpacketdump decoder to no longer output non-standard FCS field.
  • Update test-wireless to ensure new length functions work correctly.
Location:
lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcap.c

    rd5a27e8 rf0c639b  
    513513        if (packet->type==pcap_dlt_to_rt(TRACE_DLT_EN10MB))
    514514                return pcapptr->len+4; /* Include the missing FCS */
    515         else
    516                 return pcapptr->len;
     515        else if (packet->type==pcap_dlt_to_rt(TRACE_DLT_IEEE802_11_RADIO)) {
     516                /* If the packet is Radiotap and the flags field indicates
     517                 * that the FCS is not included in the 802.11 frame, then
     518                 * we need to add 4 to the wire-length to account for it.
     519                 */
     520                uint16_t flags;
     521                trace_get_wireless_flags(trace_get_link(packet), trace_get_link_type(packet), &flags);
     522                if ((flags & TRACE_RADIOTAP_F_FCS) == 0)
     523                        return pcapptr->len + 4;
     524        }
     525        return pcapptr->len;
    517526}
    518527
  • lib/format_pcapfile.c

    rc85b715 rf0c639b  
    432432                /* Include the missing FCS */
    433433                return swapl(packet->trace,pcapptr->wirelen)+4;
    434         else
    435                 return swapl(packet->trace,pcapptr->wirelen);
     434        else if (packet->type==pcap_dlt_to_rt(TRACE_DLT_IEEE802_11_RADIO)) {
     435                /* If the packet is Radiotap and the flags field indicates
     436                 * that the FCS is not included in the 802.11 frame, then
     437                 * we need to add 4 to the wire-length to account for it.
     438                 */
     439                uint16_t flags;
     440                trace_get_wireless_flags(trace_get_link(packet), trace_get_link_type(packet), &flags);
     441                if ((flags & TRACE_RADIOTAP_F_FCS) == 0)
     442                        return swapl(packet->trace,pcapptr->wirelen)+4;
     443        }
     444        return swapl(packet->trace,pcapptr->wirelen);
    436445}
    437446
  • lib/libtrace.h.in

    rbe22b51 rf0c639b  
    347347    TRACE_RADIOTAP_DB_ANTSIGNAL = 12, /**< Signal power in dB from a fixed reference (uint8) */
    348348    TRACE_RADIOTAP_DB_ANTNOISE = 13, /**< Noise power in dB from a fixed reference (uint8) */
    349     TRACE_RADIOTAP_FCS = 14, /**< Received frame check sequence (uint32) */
    350349    TRACE_RADIOTAP_EXT = 31
    351350} libtrace_radiotap_field_t;
     
    16251624        libtrace_linktype_t linktype, uint8_t *antenna);
    16261625
    1627 /** Get the wireless Frame Check Sequence field
    1628  * @param link the wireless header
    1629  * @param linktype the linktype of the wireless header passed in
    1630  * @param[out] fcs the Frame Check Sequence of the frame.
    1631  * @return true if the field was available, false if not.
    1632  */
    1633 DLLEXPORT bool trace_get_wireless_fcs(void *linkptr,
    1634         libtrace_linktype_t linktype, uint32_t *fcs);
    1635 
    16361626/*@}*/
    16371627
  • lib/libtrace_int.h

    rd5a27e8 rf0c639b  
    457457void duck_constructor(void);
    458458
    459 
     459/* Used internally by get_wire_length() methods */
     460bool trace_get_wireless_flags(void *link, libtrace_linktype_t linktype, uint8_t *flags);
     461#define TRACE_RADIOTAP_F_FCS 0x10
    460462       
    461463#ifdef __cplusplus
  • lib/link_wireless.c

    rd5a27e8 rf0c639b  
    156156        if (field == TRACE_RADIOTAP_DB_ANTNOISE)
    157157                return (void *) p;
     158        /*
    158159        if (bswap_le_to_host32(rtap->it_present) & (1 << TRACE_RADIOTAP_DB_ANTNOISE))
    159160                p+= sizeof (uint8_t);
    160 
    161         if (field == TRACE_RADIOTAP_FCS)
    162                 ALIGN_NATURAL_32(p,s);
    163         return (void *)p;
     161        */
    164162
    165163        /* Unknown field */
     
    198196 * for now. Maybe it will be included in the API later if it becomes useful
    199197 * and we come up with a suitable abstraction.
    200  */
    201 static
     198 * This function isn't marked static as the various format modules need to
     199 * access it for get_wire_length(). It's not meant to be exported though.
     200 */
    202201bool trace_get_wireless_flags(void *link,
    203202                libtrace_linktype_t linktype, uint8_t *flags)
     
    591590}
    592591
    593 DLLEXPORT bool trace_get_wireless_fcs(void *link,
    594                 libtrace_linktype_t linktype, uint32_t *fcs)
    595 {
    596         uint32_t *p;
    597         void *l;
    598         uint16_t type;
    599 
    600         if (link == NULL || fcs == NULL) return false;
    601         switch (linktype) {
    602                 case TRACE_TYPE_80211_RADIO:
    603                         if ((p = (uint32_t *) trace_get_radiotap_field(link,
    604                                                         TRACE_RADIOTAP_FCS))) {
    605                                 *fcs = bswap_le_to_host32(*p);
    606                                 return true;
    607                         } else break;
    608                 case TRACE_TYPE_LINUX_SLL:
    609                         l = trace_get_payload_from_linux_sll(link, &type, NULL);
    610                         return trace_get_wireless_fcs(l, arphrd_type_to_libtrace(type), fcs);
    611                 default:
    612                         return false;
    613         }
    614         return false;
    615 }
    616 
Note: See TracChangeset for help on using the changeset viewer.