Skip to content

Commit 7dcd584

Browse files
rlubosnashif
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 64fa3d8 commit 7dcd584

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
@@ -1269,21 +1269,25 @@ void net_if_ipv6_start_dad(struct net_if *iface,
12691269

12701270
ifaddr->dad_count = 1U;
12711271

1272-
if (!net_ipv6_start_dad(iface, ifaddr)) {
1273-
ifaddr->dad_start = k_uptime_get_32();
1274-
ifaddr->ifindex = net_if_get_by_iface(iface);
1275-
1276-
k_mutex_lock(&lock, K_FOREVER);
1277-
sys_slist_find_and_remove(&active_dad_timers,
1278-
&ifaddr->dad_node);
1279-
sys_slist_append(&active_dad_timers, &ifaddr->dad_node);
1280-
k_mutex_unlock(&lock);
1281-
1282-
/* FUTURE: use schedule, not reschedule. */
1283-
if (!k_work_delayable_remaining_get(&dad_timer)) {
1284-
k_work_reschedule(&dad_timer,
1285-
K_MSEC(DAD_TIMEOUT));
1286-
}
1272+
if (net_ipv6_start_dad(iface, ifaddr) != 0) {
1273+
NET_ERR("Interface %p failed to send DAD query for %s",
1274+
iface,
1275+
net_sprint_ipv6_addr(&ifaddr->address.in6_addr));
1276+
}
1277+
1278+
ifaddr->dad_start = k_uptime_get_32();
1279+
ifaddr->ifindex = net_if_get_by_iface(iface);
1280+
1281+
k_mutex_lock(&lock, K_FOREVER);
1282+
sys_slist_find_and_remove(&active_dad_timers,
1283+
&ifaddr->dad_node);
1284+
sys_slist_append(&active_dad_timers, &ifaddr->dad_node);
1285+
k_mutex_unlock(&lock);
1286+
1287+
/* FUTURE: use schedule, not reschedule. */
1288+
if (!k_work_delayable_remaining_get(&dad_timer)) {
1289+
k_work_reschedule(&dad_timer,
1290+
K_MSEC(DAD_TIMEOUT));
12871291
}
12881292
} else {
12891293
NET_DBG("Interface %p is down, starting DAD for %s later.",

0 commit comments

Comments
 (0)