Skip to content

Commit d40d963

Browse files
rbabubcfriedt
authored andcommitted
net: fix for assert on enabling socket CAN
Socket CAN does not require interface link address to be assigned, check is not applicable for socket CAN interfaces. As this address is NULL for socket CAN interface it results in assertion. Signed-off-by: Ramesh Babu B <[email protected]>
1 parent 8b0d345 commit d40d963

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

subsys/net/ip/net_if.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,15 @@ int net_if_up(struct net_if *iface)
39903990
/* In many places it's assumed that link address was set with
39913991
* net_if_set_link_addr(). Better check that now.
39923992
*/
3993-
NET_ASSERT(net_if_get_link_addr(iface)->addr != NULL);
3993+
#if defined(CONFIG_NET_L2_CANBUS_RAW)
3994+
if (IS_ENABLED(CONFIG_NET_SOCKETS_CAN) &&
3995+
(net_if_l2(iface) == &NET_L2_GET_NAME(CANBUS_RAW))) {
3996+
/* CAN does not require link address. */
3997+
} else
3998+
#endif /* CONFIG_NET_L2_CANBUS_RAW */
3999+
{
4000+
NET_ASSERT(net_if_get_link_addr(iface)->addr != NULL);
4001+
}
39944002

39954003
net_if_flag_set(iface, NET_IF_UP);
39964004

0 commit comments

Comments
 (0)