Print ARP table in ESP-IDF 5.1.1 version

endi83
Posts: 24
Joined: Wed Nov 22, 2023 2:43 pm

Print ARP table in ESP-IDF 5.1.1 version

Postby endi83 » Wed Feb 28, 2024 9:59 am

How can I print the ARP table of my ESP32C6 device? I have been doing some research and I have seen that with the function "etharp_for_each_entry" it is possible to get the ARP table but for ESP-IDF 5.1.1 version this function is not available.

Thank you!

MikeMyhre
Posts: 54
Joined: Sat Nov 05, 2022 3:32 am

Re: Print ARP table in ESP-IDF 5.1.1 version

Postby MikeMyhre » Wed Aug 14, 2024 5:31 pm

You can use the etharp_get_entry() function. Something like this:

Code: Select all

struct eth_addr *ethaddr;
struct netif *netif;
struct eth_addr *ea;
for( int i=0;i<ARP_TABLE_SIZE;i++ ) {
  int ret = etharp_get_entry(i,&ipaddr,&netif,&ea);
  if( ret ) {
     // print contents of IP (ipaddress->addr), interface (netif->num), mac (6 bytes)
  }
}

Who is online

Users browsing this forum: jsmith56x and 276 guests