From 7d195f1a20bdb1da597e92e6b88382c6e8aa0cf7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 6 Mar 2024 11:50:42 +0100 Subject: [PATCH] [nrf fromlist] net: sockets: packet: Ignore the packet type if LL address is not set In case the LL address is not set on a packet for any reason, don't try to access address structure to determine packet type. Upstream PR: https://github.com/zephyrproject-rtos/zephyr/pull/69850 Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets_packet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/net/lib/sockets/sockets_packet.c b/subsys/net/lib/sockets/sockets_packet.c index bcf063abe29..ce4f83190c4 100644 --- a/subsys/net/lib/sockets/sockets_packet.c +++ b/subsys/net/lib/sockets/sockets_packet.c @@ -144,6 +144,10 @@ static void zpacket_set_eth_pkttype(struct net_if *iface, struct sockaddr_ll *addr, struct net_linkaddr *lladdr) { + if (lladdr == NULL || lladdr->addr == NULL) { + return; + } + if (net_eth_is_addr_broadcast((struct net_eth_addr *)lladdr->addr)) { addr->sll_pkttype = PACKET_BROADCAST; } else if (net_eth_is_addr_multicast(