Skip to content

Commit 09e6786

Browse files
mniestrojkartben
authored andcommitted
net: ipv4: set NET_ADDR_PREFERRED before network event if !ACD
Set NET_ADDR_PREFERRED before network event is generated, so that conn_mgr properly generates NET_EVENT_L4_CONNECTED and NET_EVENT_L4_IPV4_CONNECTED events. Fixes: 1a5e13a ("net: if: Release the interface lock early when starting IPv4 ACD") Signed-off-by: Marcin Niestroj <[email protected]> (cherry picked from commit 3fcd25c)
1 parent ddf160a commit 09e6786

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

subsys/net/ip/net_if.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4369,13 +4369,7 @@ void net_if_start_acd(struct net_if *iface)
43694369
net_if_unlock(iface);
43704370
}
43714371
#else
4372-
void net_if_ipv4_start_acd(struct net_if *iface, struct net_if_addr *ifaddr)
4373-
{
4374-
ARG_UNUSED(iface);
4375-
4376-
ifaddr->addr_state = NET_ADDR_PREFERRED;
4377-
}
4378-
4372+
#define net_if_ipv4_start_acd(...)
43794373
#define net_if_start_acd(...)
43804374
#endif /* CONFIG_NET_IPV4_ACD */
43814375

@@ -4456,7 +4450,8 @@ struct net_if_addr *net_if_ipv4_addr_add(struct net_if *iface,
44564450
net_sprint_ipv4_addr(addr),
44574451
net_addr_type2str(addr_type));
44584452

4459-
if (!(l2_flags_get(iface) & NET_L2_POINT_TO_POINT) &&
4453+
if (IS_ENABLED(CONFIG_NET_IPV4_ACD) &&
4454+
!(l2_flags_get(iface) & NET_L2_POINT_TO_POINT) &&
44604455
!net_ipv4_is_addr_loopback(addr)) {
44614456
/* ACD is started after the lock is released. */
44624457
;

0 commit comments

Comments
 (0)