"etharp_request" workaround does not work anymore

jansac
Posts: 1
Joined: Thu Jan 04, 2018 11:10 am

"etharp_request" workaround does not work anymore

Postby jansac » Thu Jan 04, 2018 11:23 am

Hi everybody,

some time ago i used this workaround, because my ESP32 became inresponsive in the network after some time:

extern "C" {
extern char *netif_list;
uint8_t etharp_request(char *, char *); // required for forceArp to work
}

void forceARP() {

char *netif = netif_list;

while (netif)
{
etharp_request((netif), (netif + 4));
netif = *((char **) netif);
}
}

It is called every second and worked great. Now I try to compile it with another computer with a newer version of the Arduino IDE and the ESP32 core. It compiles, but when the forceARP() function is called I get the following error:

assertion "netif->hwaddr_len must be the same as ETH_HWADDR_LEN for etharp!" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/netif/etharp.c", line 1306, function: etharp_raw
abort() was called at PC 0x400dac57 on core 1

Any ideas?

Thanks!

SHristov
Posts: 1
Joined: Wed Jan 20, 2021 2:52 pm

Re: "etharp_request" workaround does not work anymore

Postby SHristov » Wed Jan 20, 2021 2:55 pm

I know that is very VERY old topic, but it looks that is till applicable.
I got around the issue with the following code:

Code: Select all

extern "C" {
#include "lwip/netif.h"
uint8_t etharp_request(char *, char *); // required for forceArp to work
}

void forceARP()
{
	netif *netif = netif_list;

	while (netif)
	{
		if(netif->hwaddr_len == 6)
		{
			etharp_request((char*)(netif), (char*)netif_ip4_addr(netif));
		}
		netif = netif->next;
	}
}


// The loop function is called in an endless loop
void loop()
{
	static uint32_t timer = millis();
	if((millis()-timer) >100)
	{
		timer = millis();
		forceARP();
	}
}

Who is online

Users browsing this forum: No registered users and 90 guests