- Timestamp:
- 03/23/05 18:11:01 (17 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:
- 783825a
- Parents:
- ea161ea
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/libtrace.h
r53991fa rc4be35b 375 375 TRACE_TYPE_ETH, 376 376 TRACE_TYPE_ATM, 377 TRACE_TYPE_80211 377 TRACE_TYPE_80211, 378 TRACE_TYPE_NONE, 379 TRACE_TYPE_LINUX_SLL 378 380 } libtrace_linktype_t; 379 381 -
lib/trace.c
r225cb94 rc4be35b 169 169 double last_ts; 170 170 double start_ts; 171 }; 172 173 struct trace_sll_header_t { 174 uint16_t pkttype; /* packet type */ 175 uint16_t hatype; /* link-layer address type */ 176 uint16_t halen; /* link-layer address length */ 177 char addr[8]; /* link-layer address */ 178 uint16_t protocol; /* protocol */ 171 179 }; 172 180 … … 801 809 */ 802 810 void *trace_get_link(const struct libtrace_packet_t *packet) { 803 void *ethptr = 0;811 const void *ethptr = 0; 804 812 dag_record_t *erfptr = 0; 805 813 struct wag_event_t *event = (struct wag_event_t *)packet->buffer; … … 825 833 case PCAPINT: 826 834 case PCAP: 827 ethptr = ( struct ether_header *)(packet->buffer + sizeof(struct pcap_pkthdr));835 ethptr = (packet->buffer + sizeof(struct pcap_pkthdr)); 828 836 break; 829 837 #endif … … 886 894 break; 887 895 } 896 case TRACE_TYPE_NONE: 897 ipptr = trace_get_link(packet); 898 break; 899 case TRACE_TYPE_LINUX_SLL: 900 { 901 struct trace_sll_header_t *sll; 902 903 sll = trace_get_link(packet); 904 if (ntohs(sll->protocol)!=0x0800) { 905 ipptr = NULL; 906 } 907 else { 908 ipptr = ((void*)sll)+sizeof(*sll); 909 } 910 } 911 break; 888 912 case TRACE_TYPE_ATM: 889 913 { … … 1296 1320 linktype = pcap_datalink(packet->trace->input.pcap); 1297 1321 switch (linktype) { 1298 case 1: 1322 case DLT_NULL: 1323 return TRACE_TYPE_NONE; 1324 case DLT_EN10MB: 1299 1325 return TRACE_TYPE_ETH; 1300 case 11:1326 case DLT_ATM_RFC1483: 1301 1327 return TRACE_TYPE_ATM; 1302 1328 case DLT_IEEE802_11: 1303 1329 return TRACE_TYPE_80211; 1330 #ifdef DLT_LINUX_SLL 1331 case DLT_LINUX_SLL: 1332 return TRACE_TYPE_LINUX_SLL; 1333 #endif 1304 1334 } 1305 1335 break; … … 1560 1590 dag_record_t *erfptr = 0; 1561 1591 assert(packet); 1592 direction = -1; 1562 1593 1563 1594 switch(packet->trace->format) { … … 1568 1599 direction = erfptr->flags.iface; 1569 1600 break; 1601 case PCAP: 1602 switch (trace_get_link_type(packet)) { 1603 case TRACE_TYPE_LINUX_SLL: 1604 { 1605 struct trace_sll_header_t *sll; 1606 sll = trace_get_link(packet); 1607 /* 0 == LINUX_SLL_HOST */ 1608 if (sll->pkttype==0) { 1609 direction = 0; 1610 } 1611 else { 1612 direction = 1; 1613 } 1614 break; 1615 } 1616 default: 1617 /* pass */ 1618 } 1570 1619 default: 1571 direction = -1;1620 /* pass */ 1572 1621 } 1573 1622
Note: See TracChangeset
for help on using the changeset viewer.