ethertap.cc (11263:8dcc6b40f164) | ethertap.cc (11294:a368064a2ab5) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 227 unchanged lines hidden (view full) --- 236 } 237 238 while (data_len != 0 && buffer_offset >= data_len + sizeof(uint32_t)) { 239 EthPacketPtr packet; 240 packet = make_shared<EthPacketData>(data_len); 241 packet->length = data_len; 242 memcpy(packet->data, data, data_len); 243 | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 227 unchanged lines hidden (view full) --- 236 } 237 238 while (data_len != 0 && buffer_offset >= data_len + sizeof(uint32_t)) { 239 EthPacketPtr packet; 240 packet = make_shared<EthPacketData>(data_len); 241 packet->length = data_len; 242 memcpy(packet->data, data, data_len); 243 |
244 assert(buffer_offset >= data_len + sizeof(uint32_t)); |
|
244 buffer_offset -= data_len + sizeof(uint32_t); | 245 buffer_offset -= data_len + sizeof(uint32_t); |
245 assert(buffer_offset >= 0); | |
246 if (buffer_offset > 0) { 247 memmove(buffer, data + data_len, buffer_offset); 248 data_len = ntohl(*(uint32_t *)buffer); 249 } else 250 data_len = 0; 251 252 DPRINTF(Ethernet, "EtherTap input len=%d\n", packet->length); 253 DDUMP(EthernetData, packet->data, packet->length); --- 95 unchanged lines hidden --- | 246 if (buffer_offset > 0) { 247 memmove(buffer, data + data_len, buffer_offset); 248 data_len = ntohl(*(uint32_t *)buffer); 249 } else 250 data_len = 0; 251 252 DPRINTF(Ethernet, "EtherTap input len=%d\n", packet->length); 253 DDUMP(EthernetData, packet->data, packet->length); --- 95 unchanged lines hidden --- |