tests: net: iface: Fix interface context misuse
The iface test suite uses two different interface types with two
different context types and iid tests mixed up the two. It attempted
to create a mac address for Ethernet interface (which uses
struct eth_fake_context), however the net_iface_get_mac() function
only works with Dummy interface context (struct net_if_test). In
result the Ethernet interface context was corrupted (mac address
overwritten the promisc_mode flag).
Fix this by extracting mac generation code into a common function, and
use it in the Ethernet iface initialization phase instead of directly in
the test.
This was reported by UBSAN:
tests/net/iface/src/main.c:239:34: runtime error: load of value 11,
which is not a valid value for type '_Bool'
Signed-off-by:
Robert Lubos <robert.lubos@nordicsemi.no>
Loading
Please sign in to comment