send router solicitations every 4 seconds

See bug #53973

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt 2018-06-08 23:09:13 +02:00
parent 4fa33c17bc
commit 31e07f90bd
2 changed files with 19 additions and 7 deletions

View File

@ -90,6 +90,8 @@ static netif_addr_idx_t nd6_cached_destination_index;
/* Multicast address holder. */
static ip6_addr_t multicast_address;
static u8_t nd6_tmr_rs_reduction;
/* Static buffer to parse RA packet options */
union ra_options {
struct lladdr_option lladdr;
@ -1131,15 +1133,20 @@ nd6_tmr(void)
#if LWIP_IPV6_SEND_ROUTER_SOLICIT
/* Send router solicitation messages, if necessary. */
NETIF_FOREACH(netif) {
if ((netif->rs_count > 0) && netif_is_up(netif) &&
netif_is_link_up(netif) &&
!ip6_addr_isinvalid(netif_ip6_addr_state(netif, 0)) &&
!ip6_addr_isduplicated(netif_ip6_addr_state(netif, 0))) {
if (nd6_send_rs(netif) == ERR_OK) {
netif->rs_count--;
if (!nd6_tmr_rs_reduction) {
nd6_tmr_rs_reduction = (ND6_RTR_SOLICITATION_INTERVAL / ND6_TMR_INTERVAL) - 1;
NETIF_FOREACH(netif) {
if ((netif->rs_count > 0) && netif_is_up(netif) &&
netif_is_link_up(netif) &&
!ip6_addr_isinvalid(netif_ip6_addr_state(netif, 0)) &&
!ip6_addr_isduplicated(netif_ip6_addr_state(netif, 0))) {
if (nd6_send_rs(netif) == ERR_OK) {
netif->rs_count--;
}
}
}
} else {
nd6_tmr_rs_reduction--;
}
#endif /* LWIP_IPV6_SEND_ROUTER_SOLICIT */

View File

@ -58,6 +58,11 @@ extern "C" {
/** 1 second period */
#define ND6_TMR_INTERVAL 1000
/** Router solicitations are sent in 4 second intervals (see RFC 4861, ch. 6.3.7) */
#ifndef ND6_RTR_SOLICITATION_INTERVAL
#define ND6_RTR_SOLICITATION_INTERVAL 4000
#endif
struct pbuf;
struct netif;