Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met

Add LWIP_ASSERT_CORE_LOCKED() in several places
This commit is contained in:
Dirk Ziegelmeier
2018-01-02 15:44:08 +01:00
parent 10c50dffce
commit f334ac68b6
7 changed files with 45 additions and 2 deletions

View File

@@ -105,6 +105,7 @@ static void autoip_start_probing(struct netif *netif);
void
autoip_set_struct(struct netif *netif, struct autoip *autoip)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT("netif != NULL", netif != NULL);
LWIP_ASSERT("autoip != NULL", autoip != NULL);
LWIP_ASSERT("netif already has a struct autoip set",
@@ -256,6 +257,7 @@ autoip_start(struct netif *netif)
struct autoip *autoip = netif_autoip_data(netif);
err_t result = ERR_OK;
LWIP_ASSERT_CORE_LOCKED();
LWIP_ERROR("netif is not up, old style port?", netif_is_up(netif), return ERR_ARG;);
/* Set IP-Address, Netmask and Gateway to 0 to make sure that
@@ -348,6 +350,7 @@ autoip_stop(struct netif *netif)
{
struct autoip *autoip = netif_autoip_data(netif);
LWIP_ASSERT_CORE_LOCKED();
if (autoip != NULL) {
autoip->state = AUTOIP_STATE_OFF;
if (ip4_addr_islinklocal(netif_ip4_addr(netif))) {

View File

@@ -688,6 +688,7 @@ dhcp_handle_ack(struct netif *netif, struct dhcp_msg *msg_in)
void
dhcp_set_struct(struct netif *netif, struct dhcp *dhcp)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT("netif != NULL", netif != NULL);
LWIP_ASSERT("dhcp != NULL", dhcp != NULL);
LWIP_ASSERT("netif already has a struct dhcp set", netif_dhcp_data(netif) == NULL);
@@ -709,6 +710,7 @@ dhcp_set_struct(struct netif *netif, struct dhcp *dhcp)
*/
void dhcp_cleanup(struct netif *netif)
{
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT("netif != NULL", netif != NULL);
if (netif_dhcp_data(netif) != NULL) {
@@ -736,6 +738,7 @@ dhcp_start(struct netif *netif)
struct dhcp *dhcp;
err_t result;
LWIP_ASSERT_CORE_LOCKED();
LWIP_ERROR("netif != NULL", (netif != NULL), return ERR_ARG;);
LWIP_ERROR("netif is not up, old style port?", netif_is_up(netif), return ERR_ARG;);
dhcp = netif_dhcp_data(netif);
@@ -816,6 +819,7 @@ dhcp_inform(struct netif *netif)
struct pbuf *p_out;
u16_t options_out_len;
LWIP_ASSERT_CORE_LOCKED();
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
if (dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
@@ -1154,6 +1158,7 @@ dhcp_renew(struct netif *netif)
struct pbuf *p_out;
u16_t options_out_len;
LWIP_ASSERT_CORE_LOCKED();
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_renew()\n"));
dhcp_set_state(dhcp, DHCP_STATE_RENEWING);
@@ -1312,6 +1317,7 @@ dhcp_release_and_stop(struct netif *netif)
struct dhcp *dhcp = netif_dhcp_data(netif);
ip_addr_t server_ip_addr;
LWIP_ASSERT_CORE_LOCKED();
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_release_and_stop()\n"));
if (dhcp == NULL) {
return;