mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-09-24 09:43:48 +08:00
Done some work on task #6933: converted some LWIP_ASSERTs to LWIP_ERROR to give back an error return value for LWIP_NOASSERT=1
This commit is contained in:
@@ -535,14 +535,15 @@ static void dhcp_handle_ack(struct netif *netif)
|
||||
*/
|
||||
err_t dhcp_start(struct netif *netif)
|
||||
{
|
||||
struct dhcp *dhcp = netif->dhcp;
|
||||
struct dhcp *dhcp;
|
||||
err_t result = ERR_OK;
|
||||
|
||||
#if LWIP_DHCP_AUTOIP_COOP
|
||||
autoip_init();
|
||||
#endif /* LWIP_DHCP_AUTOIP_COOP */
|
||||
|
||||
LWIP_ASSERT("netif != NULL", netif != NULL);
|
||||
LWIP_ERROR("netif == NULL", (netif == NULL), return ERR_ARG;);
|
||||
dhcp = netif->dhcp;
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
|
||||
netif->flags &= ~NETIF_FLAG_DHCP;
|
||||
|
||||
@@ -653,12 +654,12 @@ void dhcp_inform(struct netif *netif)
|
||||
/**
|
||||
* Match an ARP reply with the offered IP address.
|
||||
*
|
||||
* @param netif the network interface on which the reply was received
|
||||
* @param addr The IP address we received a reply from
|
||||
*
|
||||
*/
|
||||
void dhcp_arp_reply(struct netif *netif, struct ip_addr *addr)
|
||||
{
|
||||
LWIP_ASSERT("netif != NULL", netif != NULL);
|
||||
LWIP_ERROR("netif == NULL", (netif == NULL), return;);
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 3, ("dhcp_arp_reply()\n"));
|
||||
/* is a DHCP client doing an ARP check? */
|
||||
if ((netif->dhcp != NULL) && (netif->dhcp->state == DHCP_CHECKING)) {
|
||||
@@ -792,10 +793,11 @@ static err_t dhcp_discover(struct netif *netif)
|
||||
static void dhcp_bind(struct netif *netif)
|
||||
{
|
||||
u32_t timeout;
|
||||
struct dhcp *dhcp = netif->dhcp;
|
||||
struct dhcp *dhcp;
|
||||
struct ip_addr sn_mask, gw_addr;
|
||||
LWIP_ASSERT("dhcp_bind: netif != NULL", netif != NULL);
|
||||
LWIP_ASSERT("dhcp_bind: dhcp != NULL", dhcp != NULL);
|
||||
LWIP_ERROR("dhcp_bind: netif == NULL", (netif == NULL), return;);
|
||||
dhcp = netif->dhcp;
|
||||
LWIP_ERROR("dhcp_bind: dhcp == NULL", (dhcp == NULL), return;);
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 3, ("dhcp_bind(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
|
||||
|
||||
/* temporary DHCP lease? */
|
||||
@@ -1027,7 +1029,7 @@ err_t dhcp_release(struct netif *netif)
|
||||
void dhcp_stop(struct netif *netif)
|
||||
{
|
||||
struct dhcp *dhcp = netif->dhcp;
|
||||
LWIP_ASSERT("dhcp_stop: netif != NULL", netif != NULL);
|
||||
LWIP_ERROR("dhcp_stop: netif == NULL", (netif == NULL), return;);
|
||||
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 3, ("dhcp_stop()\n"));
|
||||
/* netif is DHCP configured? */
|
||||
@@ -1113,11 +1115,13 @@ static void dhcp_option_long(struct dhcp *dhcp, u32_t value)
|
||||
*/
|
||||
static err_t dhcp_unfold_reply(struct dhcp *dhcp)
|
||||
{
|
||||
struct pbuf *p = dhcp->p;
|
||||
struct pbuf *p;
|
||||
u8_t *ptr;
|
||||
u16_t i;
|
||||
u16_t j = 0;
|
||||
LWIP_ASSERT("dhcp->p != NULL", dhcp->p != NULL);
|
||||
LWIP_ERROR("dhcp == NULL", (dhcp == NULL), return ERR_ARG;);
|
||||
p = dhcp->p;
|
||||
LWIP_ERROR("dhcp->p == NULL", (dhcp->p == NULL), return ERR_VAL;);
|
||||
/* free any left-overs from previous unfolds */
|
||||
dhcp_free_reply(dhcp);
|
||||
/* options present? */
|
||||
@@ -1299,8 +1303,11 @@ static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_
|
||||
|
||||
static err_t dhcp_create_request(struct netif *netif)
|
||||
{
|
||||
struct dhcp *dhcp = netif->dhcp;
|
||||
struct dhcp *dhcp;
|
||||
u16_t i;
|
||||
LWIP_ERROR("dhcp_create_request: netif == NULL", (netif == NULL), return ERR_ARG;);
|
||||
dhcp = netif->dhcp;
|
||||
LWIP_ERROR("dhcp_create_request: dhcp == NULL", (dhcp == NULL), return ERR_VAL;);
|
||||
LWIP_ASSERT("dhcp_create_request: dhcp->p_out == NULL", dhcp->p_out == NULL);
|
||||
LWIP_ASSERT("dhcp_create_request: dhcp->msg_out == NULL", dhcp->msg_out == NULL);
|
||||
dhcp->p_out = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct dhcp_msg), PBUF_RAM);
|
||||
@@ -1343,7 +1350,10 @@ static err_t dhcp_create_request(struct netif *netif)
|
||||
|
||||
static void dhcp_delete_request(struct netif *netif)
|
||||
{
|
||||
struct dhcp *dhcp = netif->dhcp;
|
||||
struct dhcp *dhcp;
|
||||
LWIP_ERROR("dhcp_create_request: netif == NULL", (netif == NULL), return;);
|
||||
dhcp = netif->dhcp;
|
||||
LWIP_ERROR("dhcp_create_request: dhcp == NULL", (dhcp == NULL), return;);
|
||||
LWIP_ASSERT("dhcp_free_msg: dhcp->p_out != NULL", dhcp->p_out != NULL);
|
||||
LWIP_ASSERT("dhcp_free_msg: dhcp->msg_out != NULL", dhcp->msg_out != NULL);
|
||||
pbuf_free(dhcp->p_out);
|
||||
@@ -1360,6 +1370,7 @@ static void dhcp_delete_request(struct netif *netif)
|
||||
|
||||
static void dhcp_option_trailer(struct dhcp *dhcp)
|
||||
{
|
||||
LWIP_ERROR("dhcp_create_request: dhcp == NULL", (dhcp == NULL), return;);
|
||||
LWIP_ASSERT("dhcp_option_trailer: dhcp->msg_out != NULL\n", dhcp->msg_out != NULL);
|
||||
LWIP_ASSERT("dhcp_option_trailer: dhcp->options_out_len < DHCP_OPTIONS_LEN\n", dhcp->options_out_len < DHCP_OPTIONS_LEN);
|
||||
dhcp->msg_out->options[dhcp->options_out_len++] = DHCP_OPTION_END;
|
||||
|
||||
@@ -304,7 +304,7 @@ memp_malloc(memp_t type)
|
||||
struct memp *memp;
|
||||
SYS_ARCH_DECL_PROTECT(old_level);
|
||||
|
||||
LWIP_ASSERT("memp_malloc: type < MEMP_MAX", type < MEMP_MAX);
|
||||
LWIP_ERROR("memp_malloc: type >= MEMP_MAX", (type >= MEMP_MAX), return NULL;);
|
||||
|
||||
SYS_ARCH_PROTECT(old_level);
|
||||
#if MEMP_OVERFLOW_CHECK >= 2
|
||||
|
||||
Reference in New Issue
Block a user