Changeset a857389 for lib/format_erf.c
- Timestamp:
- 02/15/18 17:59:50 (3 years ago)
- Branches:
- cachetimestamps, develop, etsilive, master, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
- Children:
- 5a70a80
- Parents:
- 3004d6c
- git-author:
- Anthony Coddington <anthony.coddington@…> (02/14/18 16:03:04)
- git-committer:
- Shane Alcock <salcock@…> (02/15/18 17:59:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
r7ff881a ra857389 120 120 } erf_index_t; 121 121 122 123 122 /* Ethernet packets have a 2 byte padding before the packet 124 123 * so that the IP header is aligned on a 32 bit boundary. … … 132 131 dag_record_t *erfptr = (dag_record_t *)packet->header; 133 132 switch((erfptr->type & 0x7f)) { 134 case TYPE_ETH: 133 case TYPE_ETH: 134 case TYPE_COLOR_ETH: 135 135 case TYPE_DSM_COLOR_ETH: 136 case TYPE_COLOR_HASH_ETH: 136 137 return 2; 137 138 default: return 0; … … 144 145 } 145 146 } 147 } 148 149 int erf_is_color_type(uint8_t erf_type) 150 { 151 switch(erf_type & 0x7f) { 152 case TYPE_COLOR_HDLC_POS: 153 case TYPE_DSM_COLOR_HDLC_POS: 154 case TYPE_COLOR_ETH: 155 case TYPE_DSM_COLOR_ETH: 156 case TYPE_COLOR_HASH_POS: 157 case TYPE_COLOR_HASH_ETH: 158 return 1; 159 } 160 161 return 0; 146 162 } 147 163 … … 200 216 } 201 217 /* Is this a proper typed packet */ 202 if ((erf->type & 0x7f) > TYPE_AAL2) {218 if ((erf->type & 0x7f) > ERF_TYPE_MAX) { 203 219 return 0; 204 220 } … … 464 480 465 481 /* Check for loss */ 466 if ( (erfptr->type & 0x7f) == TYPE_DSM_COLOR_ETH) {482 if (erf_is_color_type(erfptr->type)) { 467 483 /* No idea how we get this yet */ 468 484 … … 521 537 522 538 /* Unknown/corrupt */ 523 if ((((dag_record_t *)packet->buffer)->type & 0x7f) > = TYPE_RAW_LINK) {539 if ((((dag_record_t *)packet->buffer)->type & 0x7f) > ERF_TYPE_MAX) { 524 540 trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, 525 541 "Corrupt or Unknown ERF type"); … … 758 774 dag_record_t *erfptr = 0; 759 775 erfptr = (dag_record_t *)packet->header; 776 777 if ((erfptr->type & 0x7f) == TYPE_META) 778 return 0; 779 760 780 return ntohs(erfptr->wlen); 761 781 } … … 764 784 dag_record_t *erfptr = 0; 765 785 assert(packet); 766 if(size > trace_get_capture_length(packet)) { 786 erfptr = (dag_record_t *)packet->header; 787 788 if(size > trace_get_capture_length(packet) || (erfptr->type & 0x7f) == TYPE_META) { 767 789 /* Can't make a packet larger */ 768 790 return trace_get_capture_length(packet); 769 791 } 792 770 793 /* Reset cached capture length - otherwise we will both return the 771 794 * wrong value here and subsequent get_capture_length() calls will 772 795 * return the wrong value. */ 773 796 packet->capture_length = -1; 774 erfptr = (dag_record_t *)packet->header;775 797 erfptr->rlen = htons(size + erf_get_framing_length(packet)); 776 798 return trace_get_capture_length(packet);
Note: See TracChangeset
for help on using the changeset viewer.