Skip to content

Commit 546386c

Browse files
rlubosmmahadevan108
authored andcommitted
net: if: Setup DAD timer regardless of DAD query result
In rare occasions when sending DAD NS packet fails, we should still setup the DAD timer, unless we implement some kind of more advanced retry mechanism. If we don't do that, the IPv6 address added to the interface will never be usable in such cases. Signed-off-by: Robert Lubos <[email protected]> (cherry picked from commit 008a7ca)
1 parent aa48023 commit 546386c

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

subsys/net/ip/net_if.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,21 +1295,25 @@ void net_if_ipv6_start_dad(struct net_if *iface,
12951295

12961296
ifaddr->dad_count = 1U;
12971297

1298-
if (!net_ipv6_start_dad(iface, ifaddr)) {
1299-
ifaddr->dad_start = k_uptime_get_32();
1300-
ifaddr->ifindex = net_if_get_by_iface(iface);
1301-
1302-
k_mutex_lock(&lock, K_FOREVER);
1303-
sys_slist_find_and_remove(&active_dad_timers,
1304-
&ifaddr->dad_node);
1305-
sys_slist_append(&active_dad_timers, &ifaddr->dad_node);
1306-
k_mutex_unlock(&lock);
1307-
1308-
/* FUTURE: use schedule, not reschedule. */
1309-
if (!k_work_delayable_remaining_get(&dad_timer)) {
1310-
k_work_reschedule(&dad_timer,
1311-
K_MSEC(DAD_TIMEOUT));
1312-
}
1298+
if (net_ipv6_start_dad(iface, ifaddr) != 0) {
1299+
NET_ERR("Interface %p failed to send DAD query for %s",
1300+
iface,
1301+
net_sprint_ipv6_addr(&ifaddr->address.in6_addr));
1302+
}
1303+
1304+
ifaddr->dad_start = k_uptime_get_32();
1305+
ifaddr->ifindex = net_if_get_by_iface(iface);
1306+
1307+
k_mutex_lock(&lock, K_FOREVER);
1308+
sys_slist_find_and_remove(&active_dad_timers,
1309+
&ifaddr->dad_node);
1310+
sys_slist_append(&active_dad_timers, &ifaddr->dad_node);
1311+
k_mutex_unlock(&lock);
1312+
1313+
/* FUTURE: use schedule, not reschedule. */
1314+
if (!k_work_delayable_remaining_get(&dad_timer)) {
1315+
k_work_reschedule(&dad_timer,
1316+
K_MSEC(DAD_TIMEOUT));
13131317
}
13141318
} else {
13151319
NET_DBG("Interface %p is down, starting DAD for %s later.",

0 commit comments

Comments
 (0)