Skip to content

Commit

Permalink
ARP table cleanup was not invoked
Browse files Browse the repository at this point in the history
  • Loading branch information
JAndrassy committed Aug 29, 2023
1 parent d043333 commit 441a30a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ IPAddress UIPEthernetClass::_dnsServerAddress;
DhcpClass* UIPEthernetClass::_dhcp(NULL);

unsigned long UIPEthernetClass::periodic_timer;
unsigned long UIPEthernetClass::arp_timer;

// Because uIP isn't encapsulated within a class we have to use global
// variables, so we can only have one TCP/IP stack per program.
Expand Down Expand Up @@ -178,6 +179,13 @@ UIPEthernetClass::tick()
{
if (!initialized)
return;

// run ARP table cleanup every 10 seconds as required by a comment in uip_arp.h
if (millis() - arp_timer > 10000) {
arp_timer = millis();
uip_arp_timer();
}

if (in_packet == NOBLOCK)
{
in_packet = Enc28J60Network::receivePacket();
Expand Down Expand Up @@ -488,3 +496,9 @@ uip_udpchksum(void)
#endif

UIPEthernetClass Ethernet;

extern "C" void serialPrint(int i);
void serialPrint(int i) {
Serial.println(i);
Serial.flush();
}
1 change: 1 addition & 0 deletions src/Ethernet.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class UIPEthernetClass
static DhcpClass* _dhcp;

static unsigned long periodic_timer;
static unsigned long arp_timer;

static void init(const uint8_t* mac);
static void configure(IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet);
Expand Down

0 comments on commit 441a30a

Please sign in to comment.