Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions subsys/net/ip/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,21 +1269,25 @@ void net_if_ipv6_start_dad(struct net_if *iface,

ifaddr->dad_count = 1U;

if (!net_ipv6_start_dad(iface, ifaddr)) {
ifaddr->dad_start = k_uptime_get_32();
ifaddr->ifindex = net_if_get_by_iface(iface);

k_mutex_lock(&lock, K_FOREVER);
sys_slist_find_and_remove(&active_dad_timers,
&ifaddr->dad_node);
sys_slist_append(&active_dad_timers, &ifaddr->dad_node);
k_mutex_unlock(&lock);

/* FUTURE: use schedule, not reschedule. */
if (!k_work_delayable_remaining_get(&dad_timer)) {
k_work_reschedule(&dad_timer,
K_MSEC(DAD_TIMEOUT));
}
if (net_ipv6_start_dad(iface, ifaddr) != 0) {
NET_ERR("Interface %p failed to send DAD query for %s",
iface,
net_sprint_ipv6_addr(&ifaddr->address.in6_addr));
}

ifaddr->dad_start = k_uptime_get_32();
ifaddr->ifindex = net_if_get_by_iface(iface);

k_mutex_lock(&lock, K_FOREVER);
sys_slist_find_and_remove(&active_dad_timers,
&ifaddr->dad_node);
sys_slist_append(&active_dad_timers, &ifaddr->dad_node);
k_mutex_unlock(&lock);

/* FUTURE: use schedule, not reschedule. */
if (!k_work_delayable_remaining_get(&dad_timer)) {
k_work_reschedule(&dad_timer,
K_MSEC(DAD_TIMEOUT));
}
} else {
NET_DBG("Interface %p is down, starting DAD for %s later.",
Expand Down Expand Up @@ -4843,8 +4847,13 @@ static void remove_ipv6_ifaddr(struct net_if *iface,
#if defined(CONFIG_NET_IPV6_DAD)
if (!net_if_flag_is_set(iface, NET_IF_IPV6_NO_ND)) {
k_mutex_lock(&lock, K_FOREVER);
sys_slist_find_and_remove(&active_dad_timers,
&ifaddr->dad_node);
if (sys_slist_find_and_remove(&active_dad_timers,
&ifaddr->dad_node)) {
/* Addreess with active DAD timer would still have
* stale entry in the neighbor cache.
*/
net_ipv6_nbr_rm(iface, &ifaddr->address.in6_addr);
}
k_mutex_unlock(&lock);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion tests/net/conn_mgr_conn/src/test_ifaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
static void test_iface_init(struct net_if *iface)
{
/* Fake link layer address is needed to silence assertions inside the net core */
static uint8_t fake_lladdr[] = { 0x01 };
static uint8_t fake_lladdr[] = { 0x00, 0x00, 0x5E, 0x00, 0x53, 0x01 };

net_if_set_link_addr(iface, fake_lladdr, sizeof(fake_lladdr), NET_LINK_DUMMY);

Expand Down
2 changes: 1 addition & 1 deletion tests/net/conn_mgr_monitor/src/test_ifaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
static void test_iface_init(struct net_if *iface)
{
/* Fake link layer address is needed to silence assertions inside the net core */
static uint8_t fake_lladdr[] = { 0x01 };
static uint8_t fake_lladdr[] = { 0x00, 0x00, 0x5E, 0x00, 0x53, 0x01 };

net_if_set_link_addr(iface, fake_lladdr, sizeof(fake_lladdr), NET_LINK_DUMMY);

Expand Down
Loading