Skip to content

Commit

Permalink
[nrf fromlist] net: sockets: packet: Ignore the packet type if LL add…
Browse files Browse the repository at this point in the history
…ress 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: zephyrproject-rtos/zephyr#69850

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
  • Loading branch information
rlubos authored and jfischer-no committed Mar 7, 2024
1 parent a8a6703 commit 7d195f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions subsys/net/lib/sockets/sockets_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 7d195f1

Please sign in to comment.