Skip to content

Commit d7d3480

Browse files
Use force
1 parent e15ebae commit d7d3480

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

connectivity/lwipstack/source/LWIPMemoryManager.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,14 @@ NetStackMemoryManager::Lifetime LWIPMemoryManager::get_lifetime(const net_stack_
121121

122122
void LWIPMemoryManager::skip_header_space(net_stack_mem_buf_t *const buf, const int32_t amount)
123123
{
124-
MBED_ASSERT(pbuf_header(static_cast<struct pbuf *>(buf), -amount) == 0);
124+
// Sanity check that we aren't making the header size negative
125+
MBED_ASSERT(amount + static_cast<struct pbuf *>(buf)->header_bytes_removed >= 0);
126+
127+
// Note: With LwIP, the header direction is inverted: a negative value "hides headers in the payload",
128+
// i.e. it increases the skip size.
129+
// Also note that because have our own independant check on the skip amount, we can use pbuf_header_force().
130+
// Otherwise, the normal pbuf_header() function cannot unskip header bytes for some types of pbufs.
131+
MBED_ASSERT(pbuf_header_force(static_cast<struct pbuf *>(buf), -amount) == 0);
125132
}
126133

127134
int32_t LWIPMemoryManager::get_header_skip_size(net_stack_mem_buf_t *buf)

tools/cmake/mbed_generate_configuration.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ endif()
3838
# First, verify that MBED_TARGET has not changed
3939
if(DEFINED MBED_INTERNAL_LAST_MBED_TARGET)
4040
if(NOT "${MBED_INTERNAL_LAST_MBED_TARGET}" STREQUAL "${MBED_TARGET}")
41-
message(FATAL_ERROR "MBED_TARGET has changed since this directory was originally configured. (previously was: ${MBED_INTERNAL_LAST_MBED_TARGET}). Due to CMake limitations, this build dir must be deleted and recreated from scratch (or use cmake --fresh [CMake 3.24 or newer]).")
41+
message(FATAL_ERROR "MBED_TARGET has changed since this directory was originally configured. (previously was: ${MBED_INTERNAL_LAST_MBED_TARGET}). Due to CMake limitations, this build dir must be deleted and recreated from scratch (or use cmake --fresh [CMake 3.24 or newer]). If using platformio, run the clean task with 'pio run -t clean'.")
4242
endif()
4343
else()
4444
if("${MBED_TARGET}" STREQUAL "")

0 commit comments

Comments
 (0)