Commit 7d8a4b5
committed
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 <[email protected]>1 parent 684baff commit 7d8a4b5
1 file changed
+15
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 83 | + | |
86 | 84 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
93 | 91 | | |
| 92 | + | |
94 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
207 | 211 | | |
208 | 212 | | |
209 | 213 | | |
| 214 | + | |
210 | 215 | | |
211 | 216 | | |
212 | 217 | | |
| |||
1364 | 1369 | | |
1365 | 1370 | | |
1366 | 1371 | | |
1367 | | - | |
1368 | | - | |
1369 | 1372 | | |
1370 | 1373 | | |
1371 | 1374 | | |
| |||
0 commit comments