Skip to content

Commit f38ff34

Browse files
mniestrojkartben
authored andcommitted
net: ipv6: set NET_ADDR_PREFERRED before network event if !DAD
Set NET_ADDR_PREFERRED before network event is generated, so that conn_mgr properly generates NET_EVENT_L4_CONNECTED and NET_EVENT_L4_IPV6_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 7290dd2)
1 parent 09e6786 commit f38ff34

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

subsys/net/ip/net_if.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,12 +1469,7 @@ static inline void iface_ipv6_dad_init(void)
14691469
}
14701470

14711471
#else
1472-
static inline void net_if_ipv6_start_dad(struct net_if *iface,
1473-
struct net_if_addr *ifaddr)
1474-
{
1475-
ifaddr->addr_state = NET_ADDR_PREFERRED;
1476-
}
1477-
1472+
#define net_if_ipv6_start_dad(...)
14781473
#define iface_ipv6_dad_init(...)
14791474
#endif /* CONFIG_NET_IPV6_DAD */
14801475

@@ -1816,11 +1811,7 @@ static void address_start_timer(struct net_if_addr *ifaddr, uint32_t vlifetime)
18161811
}
18171812
#else /* CONFIG_NET_NATIVE_IPV6 */
18181813
#define address_start_timer(...)
1819-
static inline void net_if_ipv6_start_dad(struct net_if *iface,
1820-
struct net_if_addr *ifaddr)
1821-
{
1822-
ifaddr->addr_state = NET_ADDR_PREFERRED;
1823-
}
1814+
#define net_if_ipv6_start_dad(...)
18241815
#define join_mcast_nodes(...)
18251816
#endif /* CONFIG_NET_NATIVE_IPV6 */
18261817

@@ -2037,7 +2028,8 @@ struct net_if_addr *net_if_ipv6_addr_add(struct net_if *iface,
20372028
net_sprint_ipv6_addr(addr),
20382029
net_addr_type2str(addr_type));
20392030

2040-
if (!(l2_flags_get(iface) & NET_L2_POINT_TO_POINT) &&
2031+
if (IS_ENABLED(CONFIG_NET_IPV6_DAD) &&
2032+
!(l2_flags_get(iface) & NET_L2_POINT_TO_POINT) &&
20412033
!net_ipv6_is_addr_loopback(addr) &&
20422034
!net_if_flag_is_set(iface, NET_IF_IPV6_NO_ND)) {
20432035
/* The groups are joined without locks held */

0 commit comments

Comments
 (0)