Skip to content

Commit

Permalink
do not filter mac address from within driver (d-a-v/W5500lwIP#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-a-v committed Jun 2, 2020
1 parent 59fe44e commit d80cd31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libraries/lwIP_w5100/src/utility/w5100.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ uint16_t Wiznet5100::readFrameData(uint8_t *buffer, uint16_t framesize)
wizchip_recv_data(buffer, framesize);
setSn_CR(Sn_CR_RECV);

#if 1
// let lwIP deal with mac address filtering
return framesize;
#else
// W5100 doesn't have any built-in MAC address filtering
if ((buffer[0] & 0x01) || memcmp(&buffer[0], _mac_address, 6) == 0)
{
Expand All @@ -322,6 +326,7 @@ uint16_t Wiznet5100::readFrameData(uint8_t *buffer, uint16_t framesize)
{
return 0;
}
#endif
}

uint16_t Wiznet5100::sendFrame(const uint8_t *buf, uint16_t len)
Expand Down
5 changes: 5 additions & 0 deletions libraries/lwIP_w5500/src/utility/w5500.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ uint16_t Wiznet5500::readFrameData(uint8_t *buffer, uint16_t framesize)
wizchip_recv_data(buffer, framesize);
setSn_CR(Sn_CR_RECV);

#if 1
// let lwIP deal with mac address filtering
return framesize;
#else
// Had problems with W5500 MAC address filtering (the Sn_MR_MFEN option)
// Do it in software instead:
if ((buffer[0] & 0x01) || memcmp(&buffer[0], _mac_address, 6) == 0)
Expand All @@ -395,6 +399,7 @@ uint16_t Wiznet5500::readFrameData(uint8_t *buffer, uint16_t framesize)
{
return 0;
}
#endif
}

uint16_t Wiznet5500::sendFrame(const uint8_t *buf, uint16_t len)
Expand Down

0 comments on commit d80cd31

Please sign in to comment.