1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

gnrc_netif_ethernet: use new helper function to generate MC address

This commit is contained in:
Martine Lenders 2020-10-26 16:09:17 +01:00
parent 1572489c97
commit ad3c8ba5a4
No known key found for this signature in database
GPG Key ID: CCD317364F63286F

View File

@ -62,19 +62,19 @@ static inline void _addr_set_broadcast(uint8_t *dst)
memset(dst, 0xff, ETHERNET_ADDR_LEN);
}
static inline void _addr_set_multicast(uint8_t *dst, gnrc_pktsnip_t *payload)
static inline void _addr_set_multicast(gnrc_netif_t *netif, uint8_t *dst,
gnrc_pktsnip_t *payload)
{
switch (payload->type) {
#ifdef MODULE_GNRC_IPV6
case GNRC_NETTYPE_IPV6:
/* https://tools.ietf.org/html/rfc2464#section-7 */
dst[0] = 0x33;
dst[1] = 0x33;
case GNRC_NETTYPE_IPV6: {
ipv6_hdr_t *ipv6 = payload->data;
memcpy(dst + 2, ipv6->dst.u8 + 12, 4);
gnrc_netif_ipv6_group_to_l2_group(netif, &ipv6->dst, dst);
break;
}
#endif
default:
(void)netif;
_addr_set_broadcast(dst);
break;
}
@ -128,7 +128,7 @@ static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
"are not yet supported\n");
return -ENOTSUP;
}
_addr_set_multicast(hdr.dst, payload);
_addr_set_multicast(netif, hdr.dst, payload);
}
else if (netif_hdr->dst_l2addr_len == ETHERNET_ADDR_LEN) {
memcpy(hdr.dst, gnrc_netif_hdr_get_dst_addr(netif_hdr),