Skip to content

Commit 71d6adc

Browse files
committed
FIXME: disable additional_event_mask in NetworkInterface::begin()
This change addresses an issue where combining additional_event_mask with NET_EVENT_IPV4_ADDR_ADD in the net_mgmt_event_wait_on_iface function caused unexpected behavior due to Zephyr's internal event handling. By isolating the wait to only NET_EVENT_IPV4_ADDR_ADD, we ensure that the function behaves as intended. A more robust solution involving semaphores and multiple event registrations will be implemented in the future. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
1 parent 814ad18 commit 71d6adc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libraries/SocketWrapper/SocketHelpers.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,11 @@ void NetworkInterface::setMACAddress(const uint8_t *mac) {
148148

149149
int NetworkInterface::begin(bool blocking, uint64_t additional_event_mask) {
150150
dhcp();
151-
int ret = net_mgmt_event_wait_on_iface(netif, NET_EVENT_IPV4_ADDR_ADD | additional_event_mask,
152-
NULL, NULL, NULL, blocking ? K_FOREVER : K_SECONDS(1));
151+
// FIXME: additional_event_mask cannot be ORed here due to how Zephyr
152+
// events are handled internally. Must be reworked to wait on a sem
153+
// and register multiple event masks with event_handler instead.
154+
int ret = net_mgmt_event_wait_on_iface(netif, NET_EVENT_IPV4_ADDR_ADD, NULL, NULL, NULL,
155+
blocking ? K_FOREVER : K_SECONDS(1));
153156
return (ret == 0) ? 1 : 0;
154157
}
155158

0 commit comments

Comments
 (0)