mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc_ipv6_nib: remove ESP-Now related code-duplication
This commit is contained in:
parent
6547b2185b
commit
6dcf8aad69
@ -40,8 +40,9 @@ static inline uint8_t _reverse_iid(const ipv6_addr_t *dst,
|
||||
const gnrc_netif_t *netif, uint8_t *l2addr)
|
||||
{
|
||||
switch (netif->device_type) {
|
||||
#ifdef MODULE_NETDEV_ETH
|
||||
#if defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW)
|
||||
case NETDEV_TYPE_ETHERNET:
|
||||
case NETDEV_TYPE_ESP_NOW:
|
||||
l2addr[0] = dst->u8[8] ^ 0x02;
|
||||
l2addr[1] = dst->u8[9];
|
||||
l2addr[2] = dst->u8[10];
|
||||
@ -49,7 +50,7 @@ static inline uint8_t _reverse_iid(const ipv6_addr_t *dst,
|
||||
l2addr[4] = dst->u8[14];
|
||||
l2addr[5] = dst->u8[15];
|
||||
return ETHERNET_ADDR_LEN;
|
||||
#endif /* MODULE_NETDEV_ETH */
|
||||
#endif /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) */
|
||||
#if defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_XBEE)
|
||||
case NETDEV_TYPE_IEEE802154:
|
||||
/* assume address was based on EUI-64
|
||||
@ -69,16 +70,6 @@ static inline uint8_t _reverse_iid(const ipv6_addr_t *dst,
|
||||
l2addr[0] = dst->u8[15];
|
||||
return sizeof(uint8_t);
|
||||
#endif /* MODULE_CC110X */
|
||||
#ifdef MODULE_ESP_NOW
|
||||
case NETDEV_TYPE_ESP_NOW:
|
||||
l2addr[0] = dst->u8[8] ^ 0x02;
|
||||
l2addr[1] = dst->u8[9];
|
||||
l2addr[2] = dst->u8[10];
|
||||
l2addr[3] = dst->u8[13];
|
||||
l2addr[4] = dst->u8[14];
|
||||
l2addr[5] = dst->u8[15];
|
||||
return ETHERNET_ADDR_LEN;
|
||||
#endif /* MODULE_ESP_NOW */
|
||||
default:
|
||||
(void)dst;
|
||||
(void)l2addr;
|
||||
|
@ -183,11 +183,12 @@ static inline unsigned _get_l2addr_len(gnrc_netif_t *netif,
|
||||
(void)opt;
|
||||
return sizeof(uint8_t);
|
||||
#endif /* MODULE_CC110X */
|
||||
#ifdef MODULE_NETDEV_ETH
|
||||
#if defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW)
|
||||
case NETDEV_TYPE_ETHERNET:
|
||||
case NETDEV_TYPE_ESP_NOW:
|
||||
(void)opt;
|
||||
return ETHERNET_ADDR_LEN;
|
||||
#endif /* MODULE_NETDEV_ETH */
|
||||
#endif /* defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) */
|
||||
#ifdef MODULE_NRFMIN
|
||||
case NETDEV_TYPE_NRFMIN:
|
||||
(void)opt;
|
||||
@ -204,11 +205,6 @@ static inline unsigned _get_l2addr_len(gnrc_netif_t *netif,
|
||||
return 0U;
|
||||
}
|
||||
#endif /* defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_XBEE) */
|
||||
#ifdef MODULE_ESP_NOW
|
||||
case NETDEV_TYPE_ESP_NOW:
|
||||
(void)opt;
|
||||
return ETHERNET_ADDR_LEN;
|
||||
#endif /* MODULE_ESP_NOW */
|
||||
default:
|
||||
(void)opt;
|
||||
return 0U;
|
||||
|
Loading…
Reference in New Issue
Block a user