Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an assertion failure in LwIP DHCP code when receiving an offer with > 2 DNS servers #1618

Merged
merged 2 commits into from Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions hal/src/nRF52840/lwip/lwipopts.h
Expand Up @@ -28,6 +28,10 @@

#include "lwip_logging.h"

#ifndef DEBUG_BUILD
#define LWIP_NOASSERT
#endif

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
Expand Down
29 changes: 29 additions & 0 deletions hal/src/nRF52840/lwip/sys_arch.c
Expand Up @@ -228,6 +228,9 @@ sys_mutex_lock(sys_mutex_t *mutex)

ret = xSemaphoreTakeRecursive(mutex->mut, portMAX_DELAY);
LWIP_ASSERT("failed to take the mutex", ret == pdTRUE);
#ifdef LWIP_NOASSERT
LWIP_UNUSED_ARG(ret);
#endif // LWIP_NOASSERT
}

void
Expand All @@ -239,6 +242,9 @@ sys_mutex_unlock(sys_mutex_t *mutex)

ret = xSemaphoreGiveRecursive(mutex->mut);
LWIP_ASSERT("failed to give the mutex", ret == pdTRUE);
#ifdef LWIP_NOASSERT
LWIP_UNUSED_ARG(ret);
#endif // LWIP_NOASSERT
}

void
Expand Down Expand Up @@ -271,7 +277,12 @@ sys_sem_new(sys_sem_t *sem, u8_t initial_count)
if(initial_count == 1) {
BaseType_t ret = xSemaphoreGive(sem->sem);
LWIP_ASSERT("sys_sem_new: initial give failed", ret == pdTRUE);

#ifdef LWIP_NOASSERT
LWIP_UNUSED_ARG(ret);
#endif // LWIP_NOASSERT
}

return ERR_OK;
}

Expand All @@ -286,6 +297,10 @@ sys_sem_signal(sys_sem_t *sem)
/* queue full is OK, this is a signal only... */
LWIP_ASSERT("sys_sem_signal: sane return value",
(ret == pdTRUE) || (ret == errQUEUE_FULL));

#ifdef LWIP_NOASSERT
LWIP_UNUSED_ARG(ret);
#endif // LWIP_NOASSERT
}

u32_t
Expand Down Expand Up @@ -350,6 +365,10 @@ sys_mbox_post(sys_mbox_t *mbox, void *msg)

ret = xQueueSendToBack(mbox->mbx, &msg, portMAX_DELAY);
LWIP_ASSERT("mbox post failed", ret == pdTRUE);

#ifdef LWIP_NOASSERT
LWIP_UNUSED_ARG(ret);
#endif // LWIP_NOASSERT
}

err_t
Expand Down Expand Up @@ -491,6 +510,11 @@ sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize
LWIP_ASSERT("task creation failed", ret == pdTRUE);

lwip_thread.thread_handle = rtos_task;

#ifdef LWIP_NOASSERT
LWIP_UNUSED_ARG(ret);
#endif // LWIP_NOASSERT

return lwip_thread;
}

Expand Down Expand Up @@ -612,6 +636,11 @@ sys_check_core_locking(void)
#else /* LWIP_TCPIP_CORE_LOCKING */
LWIP_ASSERT("Function called from wrong thread", current_thread == lwip_tcpip_thread);
#endif /* LWIP_TCPIP_CORE_LOCKING */

#ifdef LWIP_NOASSERT
LWIP_UNUSED_ARG(current_thread);
#endif // LWIP_NOASSERT

}
#endif /* !NO_SYS */
}
Expand Down
3 changes: 3 additions & 0 deletions third_party/lwip/build.mk
Expand Up @@ -5,6 +5,9 @@ include $(TARGET_LWIP_SRC_PATH)/Filelists.mk

CSRC += $(LWIPNOAPPSFILES)

# FIXME: we'd rather not have this enabled and instead fix the issue in LwIP code
CFLAGS += -Wno-unused-variable

ifeq ("$(PLATFORM_LWIP)","posix")
CSRC += $(LWIP_MODULE_PATH)/lwip-contrib/ports/unix/port/netif/tapif.c
endif
2 changes: 1 addition & 1 deletion third_party/lwip/lwip
Submodule lwip updated 1 files
+1 −1 src/core/ipv4/dhcp.c