- Timestamp:
- 08/06/15 17:41:06 (6 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
- c24de65
- Parents:
- fc0325e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
rc69aecb rb13caea 49 49 #include <string.h> 50 50 #include <stdlib.h> 51 51 52 52 53 #ifdef WIN32 … … 135 136 if (packet->trace->format->type==TRACE_FORMAT_ERF) { 136 137 dag_record_t *erfptr = (dag_record_t *)packet->header; 137 switch( erfptr->type) {138 switch((erfptr->type & 0x7f)) { 138 139 case TYPE_ETH: 139 140 case TYPE_DSM_COLOR_ETH: … … 152 153 int erf_get_framing_length(const libtrace_packet_t *packet) 153 154 { 154 return dag_record_size + erf_get_padding(packet); 155 uint16_t extsize = 0; 156 dag_record_t *erfptr = NULL; 157 uint64_t *exthdr = NULL; 158 159 erfptr = (dag_record_t *)packet->header; 160 if ((erfptr->type & 0x80) == 0x80) { 161 /* Extension headers are present */ 162 exthdr = (uint64_t *)((char *)packet->header + dag_record_size); 163 extsize += 8; 164 165 while (*exthdr < (1UL << 31)) { 166 extsize += 8; 167 exthdr ++; 168 assert(extsize <= ntohs(erfptr->rlen)); 169 } 170 } 171 172 173 return dag_record_size + extsize + erf_get_padding(packet); 155 174 } 156 175 … … 186 205 } 187 206 /* Is this a proper typed packet */ 188 if ( erf->type> TYPE_AAL2) {207 if ((erf->type & 0x7f) > TYPE_AAL2) { 189 208 return 0; 190 209 } … … 448 467 449 468 /* Check for loss */ 450 if ( erfptr->type== TYPE_DSM_COLOR_ETH) {469 if ((erfptr->type & 0x7f) == TYPE_DSM_COLOR_ETH) { 451 470 /* No idea how we get this yet */ 452 471 … … 505 524 506 525 /* Unknown/corrupt */ 507 if ((( dag_record_t *)packet->buffer)->type>= TYPE_RAW_LINK) {526 if ((((dag_record_t *)packet->buffer)->type & 0x7f) >= TYPE_RAW_LINK) { 508 527 trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, 509 528 "Corrupt or Unknown ERF type"); … … 684 703 dag_record_t *erfptr = 0; 685 704 erfptr = (dag_record_t *)packet->header; 686 if (erfptr->type != TYPE_LEGACY) 687 return erf_type_to_libtrace(erfptr->type); 705 uint8_t type = (erfptr->type & 0x7f); 706 if (type != TYPE_LEGACY) { 707 /* The top-most bit is now used to indicate the presence of 708 * extension headers :/ */ 709 return erf_type_to_libtrace(type); 710 } 688 711 else { 689 712 /* Sigh, lets start wildly guessing */
Note: See TracChangeset
for help on using the changeset viewer.