diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h index cc3e62a863..602bc3da92 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h @@ -350,6 +350,26 @@ _nib_onl_entry_t *_nib_onl_iter(const _nib_onl_entry_t *last); */ _nib_onl_entry_t *_nib_onl_get(const ipv6_addr_t *addr, unsigned iface); +/** + * @brief Gets a node by IPv6 address and interface from the neighbor cache + * + * @pre `(addr != NULL)` + * + * @param[in] addr The address of a node. Must not be NULL. + * @param[in] iface The interface to the node. May be 0 for any interface. + * + * @return The Neighbor Cache entry for node with @p addr and @p iface on success. + * @return NULL, if there is no such entry. + */ +static inline _nib_onl_entry_t *_nib_onl_nc_get(const ipv6_addr_t *addr, unsigned iface) +{ + _nib_onl_entry_t *nce = _nib_onl_get(addr, iface); + if (nce && (nce->mode & _NC)) { + return nce; + } + return NULL; +} + /** * @brief Creates or gets an existing node from the neighbor cache by address *