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

Robustness fixes for netstack #44

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions libraries/net/eth/lwip-eth/arch/lpc17_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
struct lpc_enetdata *lpc_enetif = netif->state;
struct pbuf *p = NULL;
u32_t idx, length;
u16_t origLength;

#ifdef LOCK_RX_THREAD
#if NO_SYS == 0
Expand Down Expand Up @@ -428,6 +429,7 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)

/* Zero-copy */
p = lpc_enetif->rxb[idx];
origLength = p->len;
p->len = (u16_t) length;

/* Free pbuf from descriptor */
Expand All @@ -440,6 +442,7 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
LINK_STATS_INC(link.drop);

/* Re-queue the pbuf for receive */
p->len = origLength;
lpc_rxqueue_pbuf(lpc_enetif, p);

LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
Expand Down Expand Up @@ -809,9 +812,8 @@ static void packet_rx(void* pvParameters) {
/* Wait for receive task to wakeup */
sys_arch_sem_wait(&lpc_enetif->RxSem, 0);

/* Process packets until all empty */
while (LPC_EMAC->RxConsumeIndex != LPC_EMAC->RxProduceIndex)
lpc_enetif_input(lpc_enetif->netif);
/* Process packet for this semaphore signal */
lpc_enetif_input(lpc_enetif->netif);
}
}

Expand Down
2 changes: 2 additions & 0 deletions libraries/net/lwip/lwip/core/pbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,8 @@ pbuf_coalesce(struct pbuf *p, pbuf_layer layer)
}
err = pbuf_copy(q, p);
LWIP_ASSERT("pbuf_copy failed", err == ERR_OK);
/* next line references err variable even if LWIP_ASSERT is ignored. */
(void)err;
pbuf_free(p);
return q;
}
Expand Down
3 changes: 3 additions & 0 deletions libraries/net/lwip/lwip/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#if NO_SYS == 0
#include "cmsis_os.h"

#define SYS_LIGHTWEIGHT_PROT 1

#define LWIP_RAW 0

#define TCPIP_MBOX_SIZE 8
Expand Down Expand Up @@ -99,6 +101,7 @@
#define MEMP_OVERFLOW_CHECK 1
#define MEMP_SANITY_CHECK 1
#else
#define LWIP_NOASSERT 1
#define LWIP_STATS 0
#endif

Expand Down