mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 00:56:38 +08:00
feat(lwip): send arp request every 10s
This commit is contained in:
@ -35,6 +35,8 @@
|
||||
#define LWIP_ESP8266
|
||||
|
||||
#define SOCKETS_MT
|
||||
#define ESP_GRATUITOUS_ARP 1
|
||||
#define GARP_TMR_INTERVAL 10000
|
||||
|
||||
//#define SOCKETS_TCP_TRACE
|
||||
/*
|
||||
|
17
third_party/lwip/core/timers.c
vendored
17
third_party/lwip/core/timers.c
vendored
@ -228,6 +228,19 @@ dns_timer(void *arg)
|
||||
}
|
||||
#endif /* LWIP_DNS */
|
||||
|
||||
#if ESP_GRATUITOUS_ARP
|
||||
extern void garp_tmr(void);
|
||||
|
||||
static void garp_timer(void *arg)
|
||||
{
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: garp_tmr()\n"));
|
||||
garp_tmr();
|
||||
sys_timeout(GARP_TMR_INTERVAL, garp_timer, NULL);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV6
|
||||
/**
|
||||
* Timer callback function that calls nd6_tmr() and reschedules itself.
|
||||
@ -310,6 +323,10 @@ sys_timeouts_init(void)
|
||||
#endif /* LWIP_IPV6_MLD */
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
#if ESP_GRATUITOUS_ARP
|
||||
sys_timeout(GARP_TMR_INTERVAL, garp_timer, NULL);
|
||||
#endif
|
||||
|
||||
#if NO_SYS
|
||||
/* Initialise timestamp for sys_check_timeouts */
|
||||
timeouts_last_time = GET_SYS_TIME_NOW;
|
||||
|
20
third_party/lwip/netif/etharp.c
vendored
20
third_party/lwip/netif/etharp.c
vendored
@ -56,6 +56,9 @@
|
||||
#include "lwip/autoip.h"
|
||||
#include "netif/etharp.h"
|
||||
#include "lwip/ip6.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_sta.h"
|
||||
|
||||
#if PPPOE_SUPPORT
|
||||
#include "netif/ppp_oe.h"
|
||||
@ -149,6 +152,23 @@ static u8_t etharp_cached_entry;
|
||||
#error "ARP_TABLE_SIZE must fit in an s8_t, you have to reduce it in your lwipopts.h"
|
||||
#endif
|
||||
|
||||
#if ESP_GRATUITOUS_ARP
|
||||
void garp_tmr(void)
|
||||
{
|
||||
uint8 status = wifi_station_get_connect_status();
|
||||
struct netif* garp_netif = (struct netif *)eagle_lwip_getif(STATION_IF);
|
||||
struct ip_info sta_info;
|
||||
|
||||
if (garp_netif != NULL && status == STATION_GOT_IP) {
|
||||
wifi_get_ip_info(STATION_IF, &sta_info);
|
||||
if (netif_is_up(garp_netif) && netif_is_link_up(garp_netif) && !ip_addr_isany(&(sta_info.ip))) {
|
||||
if (garp_netif->flags & NETIF_FLAG_ETHARP) {
|
||||
etharp_gratuitous(garp_netif);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ARP_QUEUEING
|
||||
/**
|
||||
|
Reference in New Issue
Block a user