gnrc_netif: use 6LoENC only when 6Lo flag is set

This commit is contained in:
Martine Lenders 2018-12-27 21:33:54 +01:00 committed by Martine S. Lenders
parent 1c7e1c9efd
commit 5d11cf26f0
2 changed files with 10 additions and 3 deletions

View File

@ -337,13 +337,17 @@ static inline bool gnrc_netif_is_rtr_adv(const gnrc_netif_t *netif)
* @ref net_gnrc_sixlowpan module is included. When the
* @ref net_gnrc_sixlowpan module is not included, it is assumed
* to be false.
* Since `gnrc_sixloenc` makes the interface's 6Lo capabilities
* configurable for an Ethernet interface, this does not apply,
* when that module is compiled in.
*
* @param[in] netif the network interface
*
* @return true, if the interface represents a 6LN
* @return false, if the interface does not represent a 6LN
*/
#if ((GNRC_NETIF_NUMOF > 1) && defined(MODULE_GNRC_SIXLOWPAN)) || defined(DOXYGEN)
#if ((GNRC_NETIF_NUMOF > 1) && defined(MODULE_GNRC_SIXLOWPAN)) || \
defined(MODULE_GNRC_SIXLOENC) || defined(DOXYGEN)
bool gnrc_netif_is_6lo(const gnrc_netif_t *netif);
#elif (GNRC_NETIF_NUMOF == 1) && defined(MODULE_GNRC_SIXLOWPAN)
#define gnrc_netif_is_6lo(netif) (true)

View File

@ -1142,12 +1142,14 @@ static ipv6_addr_t *_src_addr_selection(gnrc_netif_t *netif,
}
#endif /* MODULE_GNRC_IPV6 */
#if (GNRC_NETIF_NUMOF > 1) && defined(MODULE_GNRC_SIXLOWPAN)
#if ((GNRC_NETIF_NUMOF > 1) && defined(MODULE_GNRC_SIXLOWPAN)) || \
defined(MODULE_GNRC_SIXLOENC)
bool gnrc_netif_is_6lo(const gnrc_netif_t *netif)
{
switch (netif->device_type) {
#ifdef MODULE_GNRC_SIXLOENC
case NETDEV_TYPE_ETHERNET:
return (netif->flags & GNRC_NETIF_FLAGS_6LO);
#endif
case NETDEV_TYPE_IEEE802154:
case NETDEV_TYPE_CC110X:
@ -1159,7 +1161,8 @@ bool gnrc_netif_is_6lo(const gnrc_netif_t *netif)
return false;
}
}
#endif /* (GNRC_NETIF_NUMOF > 1) && defined(MODULE_GNRC_SIXLOWPAN) */
#endif /* ((GNRC_NETIF_NUMOF > 1) && defined(MODULE_GNRC_SIXLOWPAN)) || \
* defined(MODULE_GNRC_SIXLOENC)*/
static void _update_l2addr_from_dev(gnrc_netif_t *netif)
{