- Timestamp:
- 03/08/13 17:03:29 (9 years ago)
- 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:
- 6e6577d
- Parents:
- 19526f3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_bpf.c
rc909fad ra181666 78 78 uint32_t bh_datalen; /* wire length */ 79 79 uint16_t bh_hdrlen; /* header length (incl padding) */ 80 }; 81 82 struct local_bpf_hdr { 83 struct timeval bh_tstamp; 84 uint32_t bh_caplen; 85 uint32_t bh_datalen; 86 uint16_t bh_hdrlen; 80 87 }; 81 88 … … 362 369 void *buffer, libtrace_rt_types_t rt_type, uint32_t flags) { 363 370 371 struct local_bpf_hdr orig; 372 struct local_bpf_hdr *ptr; 373 struct libtrace_bpf_hdr *replace; 374 364 375 /* If the packet previously owned a buffer that is not the buffer 365 376 * that contains the new packet data, we're going to need to free the … … 380 391 packet->header = buffer; 381 392 packet->type = rt_type; 393 394 /* FreeBSD is stupid and uses a timeval in the bpf header 395 * structure. This means that sometimes our timestamp consumes 396 * 8 bytes and sometimes it consumes 16 bytes. 397 * 398 * Let's try to standardise our header a bit, hopefully without 399 * overwriting anything else important */ 400 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; 410 382 411 383 412 /* Find the payload */
Note: See TracChangeset
for help on using the changeset viewer.