Changeset 13bcf9e


Ignore:
Timestamp:
11/17/15 10:16:10 (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:
38c00dd, 89aa13f
Parents:
206109f
Message:

Fix race condition when adjusting BPF headers on FreeBSD 9

Turns out that doing variable assignment by dereferencing a pointer with
'*' doesn't necessarily result in a copy operation on some systems.

Changed this to a more explicit memcpy so we don't end up accidentally
overwriting parts of the BPF header that we still need.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_bpf.c

    r08f5060 r13bcf9e  
    407407                ptr = ((struct local_bpf_hdr *)(packet->header));
    408408                replace = ((struct libtrace_bpf_hdr *)(packet->header));
    409                 orig = *ptr;
     409                memcpy(&orig, ptr, sizeof(struct local_bpf_hdr));
    410410
    411411                replace->bh_tstamp.tv_sec = (uint32_t) (orig.bh_tstamp.tv_sec & 0xffffffff);
Note: See TracChangeset for help on using the changeset viewer.