Changeset 2627439
- Timestamp:
- 11/30/12 15:04:47 (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:
- f00c146
- Parents:
- f240823
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_bpf.c
rb8cb571 r2627439 383 383 { 384 384 uint32_t flags = 0; 385 386 packet->type = bpf_linktype_to_rt(swapl(libtrace, 387 FORMATIN(libtrace)->linktype)); 385 388 386 389 /* Read from the BPF interface into our capture buffer */ … … 417 420 * buffer */ 418 421 if (bpf_prepare_packet(libtrace, packet, FORMATIN(libtrace)->bufptr, 419 TRACE_RT_DATA_BPF, flags)) {422 packet->type, flags)) { 420 423 return -1; 421 424 } … … 438 441 /* Convert the linktype that we recorded when we started the trace 439 442 * into a suitable libtrace linktype */ 440 return pcap_linktype_to_libtrace( FORMATIN(packet->trace)->linktype);443 return pcap_linktype_to_libtrace(rt_to_pcap_linktype(packet->type)); 441 444 } 442 445 -
lib/libtrace.h.in
rd500159 r2627439 345 345 TRACE_RT_DATA_LINUX_NATIVE=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LINUX_NATIVE, 346 346 /** RT is encapsulating a BSD native capture record */ 347 TRACE_RT_DATA_BPF =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_BPF,347 //TRACE_RT_DATA_BPF =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_BPF, 348 348 /** RT is encapsulating a TSH capture record */ 349 349 TRACE_RT_DATA_TSH =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_TSH, … … 377 377 * encapsulation */ 378 378 TRACE_RT_DATA_DLT_END = 2999, 379 /** BPF does not store the linktype with the packet, so we need a 380 * separate RT type for each supported DLT. This value represents the 381 * starting point */ 382 TRACE_RT_DATA_BPF = 3000, 383 384 TRACE_RT_BPF_NULL = TRACE_RT_DATA_BPF+TRACE_DLT_NULL, 385 TRACE_RT_BPF_EN10MB = TRACE_RT_DATA_BPF+TRACE_DLT_EN10MB, 386 TRACE_RT_BPF_IEEE802_11 = TRACE_RT_DATA_BPF+TRACE_DLT_IEEE802_11, 387 TRACE_RT_BPF_PFLOG =TRACE_RT_DATA_BPF+TRACE_DLT_PFLOG, 388 TRACE_RT_BPF_ATM_RFC1483 =TRACE_RT_DATA_BPF+TRACE_DLT_ATM_RFC1483, 389 390 TRACE_RT_DATA_BPF_END = 3999, 379 391 /** Unused value marking the end of the valid range for all RT packet 380 392 * types */ 381 TRACE_RT_LAST = 3000393 TRACE_RT_LAST = 4000 382 394 } libtrace_rt_types_t; 383 395 -
lib/linktypes.c
r64d4398 r2627439 164 164 case TRACE_TYPE_ATM: return TYPE_ATM; 165 165 case TRACE_TYPE_AAL5: return TYPE_AAL5; 166 167 /* Not technically correct! Could be IPv6 packet 168 * 169 * TODO: Maybe we want TRACE_TYPE_RAW_IPV4 and 170 * TRACE_TYPE_RAW_IPV6 to replace TRACE_TYPE_NONE. 171 * Still need a good way to figure out how to convert 172 * TRACE_DLT_LINKTYPE_RAW into the correct type for the 173 * IP version though :( */ 166 174 case TRACE_TYPE_NONE: return TYPE_IPV4; 167 175 /* Unsupported conversions */ … … 360 368 return false; 361 369 362 #if 0363 switch(ntohs(((libtrace_sll_header_t*)packet->payload)364 ->hatype)) {365 case ARPHRD_PPP:366 packet->type=pcap_linktype_to_rt(TRACE_DLT_RAW);367 break;368 case ARPHRD_ETHER:369 packet->type=pcap_linktype_to_rt(TRACE_DLT_EN10MB);370 break;371 default:372 /* Dunno how to demote this packet */373 return false;374 }375 #endif376 370 /* Skip the Linux SLL header */ 377 371 packet->payload=(void*)((char*)packet->payload
Note: See TracChangeset
for help on using the changeset viewer.