Changeset 6e6577d


Ignore:
Timestamp:
03/08/13 17:34:11 (9 years ago)
Author:
Shane Alcock <salcock@…>
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:
2216d25
Parents:
a181666
Message:
  • Mac OSX is a lot smarter about this whole timeval thing - defining a BPF_TIMEVAL as a timeval32 and using that. Which is great, but means things go horribly wrong if I just have a struct timeval in my local_bpf_hdr struct.... Now fixed and working on Mac, just need a little test on FreeBSD again
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_bpf.c

    ra181666 r6e6577d  
    8080};
    8181
     82#ifndef BPF_TIMEVAL
     83#define BPF_TIMEVAL timeval
     84#endif
     85
    8286struct local_bpf_hdr {
    83         struct timeval bh_tstamp;
     87        struct BPF_TIMEVAL bh_tstamp;
    8488        uint32_t bh_caplen;
    8589        uint32_t bh_datalen;
     
    399403         * overwriting anything else important */
    400404
    401         ptr = ((struct local_bpf_hdr *)(packet->header));
    402         replace = ((struct libtrace_bpf_hdr *)(packet->header));
    403         orig = *ptr;
    404        
    405         replace->bh_tstamp.tv_sec = (uint32_t) (orig.bh_tstamp.tv_sec & 0xffffffff);
    406         replace->bh_tstamp.tv_usec = (uint32_t) (orig.bh_tstamp.tv_usec & 0xffffffff);
    407         replace->bh_caplen = orig.bh_caplen;
    408         replace->bh_datalen = orig.bh_datalen;
    409         replace->bh_hdrlen = orig.bh_hdrlen;
     405        if (sizeof(struct BPF_TIMEVAL) != sizeof(struct bpf_timeval)) {         
    410406               
     407                ptr = ((struct local_bpf_hdr *)(packet->header));
     408                replace = ((struct libtrace_bpf_hdr *)(packet->header));
     409                orig = *ptr;
     410
     411                replace->bh_tstamp.tv_sec = (uint32_t) (orig.bh_tstamp.tv_sec & 0xffffffff);
     412                replace->bh_tstamp.tv_usec = (uint32_t) (orig.bh_tstamp.tv_usec & 0xffffffff);
     413                replace->bh_caplen = orig.bh_caplen;
     414                replace->bh_datalen = orig.bh_datalen;
     415                replace->bh_hdrlen = orig.bh_hdrlen;
     416
     417
     418        }
    411419
    412420        /* Find the payload */
Note: See TracChangeset for help on using the changeset viewer.