Changeset 84d137d
- Timestamp:
- 08/04/15 13:57:38 (7 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:
- 0277ab8
- Parents:
- 7428ab2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/protocols_l2.c
r7428ab2 r84d137d 109 109 uint32_t remaining; 110 110 libtrace_packet_t *copy; 111 void*payload;111 char *payload; 112 112 uint16_t finalethertype = 0; 113 113 uint16_t caplen, removed = 0; … … 145 145 } 146 146 147 payload = (char *)trace_get_layer3(packet, ðertype, &remaining); 148 caplen = trace_get_capture_length(packet); 149 dest = ((char *)ethernet) + sizeof(libtrace_ether_t); 150 151 if (payload == NULL || remaining == 0) 152 return packet; 153 154 if (payload == dest) 155 return packet; 156 157 ethernet->ether_type = ntohs(ethertype); 158 trace_set_capture_length(packet, caplen - (payload - dest)); 159 memmove(payload - (dest - (char *)packet->payload), packet->payload, 160 (dest - (char *)packet->payload)); 161 packet->payload = payload - (dest - (char *)packet->payload); 162 packet->l2_header = NULL; 163 packet->l3_header = NULL; 164 packet->l4_header = NULL; 165 166 /* 147 167 payload = trace_get_payload_from_layer2(ethernet, linktype, 148 168 ðertype, &remaining); 149 169 150 dest = ((char *)ethernet) + sizeof(libtrace_ether_t);151 caplen = trace_get_capture_length(packet);152 170 while (!done) { 153 171 … … 164 182 { 165 183 removed += (oldrem - remaining); 166 memmove(dest, payload, remaining);167 payload = dest;184 //memmove(dest, payload, remaining); 185 //payload = dest; 168 186 169 187 } else { … … 171 189 finalethertype = TRACE_ETHERTYPE_8021Q; 172 190 } 173 dest = payload;191 //dest = payload; 174 192 } 175 193 break; … … 181 199 { 182 200 removed += (oldrem - remaining); 183 memmove(dest, payload, remaining);184 payload = dest;201 //memmove(dest, payload, remaining); 202 //payload = dest; 185 203 186 204 } else { … … 188 206 finalethertype = TRACE_ETHERTYPE_MPLS; 189 207 } 190 dest = payload;208 //dest = payload; 191 209 } 192 210 break; … … 201 219 } 202 220 } 203 221 */ 204 222 /* Update the preceding headers to match the new packet contents */ 205 ethernet->ether_type = ntohs(finalethertype);206 trace_set_capture_length(packet, caplen - removed);207 223 return packet; 208 224
Note: See TracChangeset
for help on using the changeset viewer.