Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport v4.0-branch] tests: net: Fix conn_mgr_monitor tests #86031

Merged
merged 3 commits into from
Feb 26, 2025
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 @@ -1295,22 +1295,26 @@

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));

Check notice on line 1301 in subsys/net/ip/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/net/ip/net_if.c:1301 - NET_ERR("Interface %p failed to send DAD query for %s", - iface, + NET_ERR("Interface %p failed to send DAD query for %s", iface,

Check notice on line 1301 in subsys/net/ip/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/net/ip/net_if.c:1301 - NET_ERR("Interface %p failed to send DAD query for %s", - iface, + NET_ERR("Interface %p failed to send DAD query for %s", iface,
}

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));
}

Check notice on line 1317 in subsys/net/ip/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/net/ip/net_if.c:1317 - sys_slist_find_and_remove(&active_dad_timers, - &ifaddr->dad_node); + 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)); + k_work_reschedule(&dad_timer, K_MSEC(DAD_TIMEOUT));

Check notice on line 1317 in subsys/net/ip/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/net/ip/net_if.c:1317 - sys_slist_find_and_remove(&active_dad_timers, - &ifaddr->dad_node); + 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)); + k_work_reschedule(&dad_timer, K_MSEC(DAD_TIMEOUT));
} else {
NET_DBG("Interface %p is down, starting DAD for %s later.",
iface,
Expand Down Expand Up @@ -4932,8 +4936,13 @@
#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

Check notice on line 4941 in subsys/net/ip/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/net/ip/net_if.c:4941 - if (sys_slist_find_and_remove(&active_dad_timers, - &ifaddr->dad_node)) { + if (sys_slist_find_and_remove(&active_dad_timers, &ifaddr->dad_node)) {

Check notice on line 4941 in subsys/net/ip/net_if.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/net/ip/net_if.c:4941 - if (sys_slist_find_and_remove(&active_dad_timers, - &ifaddr->dad_node)) { + if (sys_slist_find_and_remove(&active_dad_timers, &ifaddr->dad_node)) {
* 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,8 +16,8 @@
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 };

Check notice on line 20 in tests/net/conn_mgr_conn/src/test_ifaces.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/net/conn_mgr_conn/src/test_ifaces.c:20 - static uint8_t fake_lladdr[] = { 0x00, 0x00, 0x5E, 0x00, 0x53, 0x01 }; + static uint8_t fake_lladdr[] = {0x00, 0x00, 0x5E, 0x00, 0x53, 0x01};

Check notice on line 20 in tests/net/conn_mgr_conn/src/test_ifaces.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/net/conn_mgr_conn/src/test_ifaces.c:20 - static uint8_t fake_lladdr[] = { 0x00, 0x00, 0x5E, 0x00, 0x53, 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);

/* Do not automatically start the iface */
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,8 +15,8 @@
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 };

Check notice on line 19 in tests/net/conn_mgr_monitor/src/test_ifaces.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/net/conn_mgr_monitor/src/test_ifaces.c:19 - static uint8_t fake_lladdr[] = { 0x00, 0x00, 0x5E, 0x00, 0x53, 0x01 }; + static uint8_t fake_lladdr[] = {0x00, 0x00, 0x5E, 0x00, 0x53, 0x01};

Check notice on line 19 in tests/net/conn_mgr_monitor/src/test_ifaces.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

tests/net/conn_mgr_monitor/src/test_ifaces.c:19 - static uint8_t fake_lladdr[] = { 0x00, 0x00, 0x5E, 0x00, 0x53, 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);

/* Do not automatically start the iface */
Expand Down
Loading