net: ethernet: Set dest MAC address for IPv4 mcast

If the ethernet packet destination MAC address is NULL when sending
IPv4 multicast or broadcast packet, then we must set it as otherwise
we might to access NULL pointer data.

Fixes #1544

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-09-20 09:34:47 +03:00
parent 2e50126f55
commit 9369538642

View file

@ -194,9 +194,13 @@ static enum net_verdict ethernet_send(struct net_if *iface,
struct net_pkt *arp_pkt;
if (check_if_dst_is_broadcast_or_mcast(iface, pkt)) {
struct net_eth_addr *dst = &NET_ETH_HDR(pkt)->dst;
if (!net_pkt_ll_dst(pkt)->addr) {
struct net_eth_addr *dst;
dst = &NET_ETH_HDR(pkt)->dst;
net_pkt_ll_dst(pkt)->addr = (u8_t *)dst->addr;
}
net_pkt_ll_dst(pkt)->addr = (u8_t *)dst->addr;
goto setup_hdr;
}