When a host in the same subnet changes their IP / mac address
association, we could have some "deprecated" frames in the ethernet
buffer.
The hardware seems to explicitly mark them, cleaning the ownership bit.
If this happens simply drop the frame and do not pass it to the upper
layers.
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4494
38d2e660-2303-0410-9eaa-
f027e97ec537
rd_len += EMAC_RX_BUFSIZ;
else
rd_len += len - rd_len;
- ASSERT(rx_buf_tab[rx_buf_idx].addr & RXBUF_OWNERSHIP);
+ if (UNLIKELY(!(rx_buf_tab[rx_buf_idx].addr & RXBUF_OWNERSHIP)))
+ {
+ LOG_INFO("bad frame found\n");
+ return 0;
+ }
rx_buf_tab[rx_buf_idx].addr &= ~RXBUF_OWNERSHIP;
if (++rx_buf_idx >= EMAC_RX_DESCRIPTORS)
rx_buf_idx = 0;