diff --git a/sys/include/net/ng_ipv6/addr.h b/sys/include/net/ng_ipv6/addr.h
index 511cd4f50d..100ae26098 100644
--- a/sys/include/net/ng_ipv6/addr.h
+++ b/sys/include/net/ng_ipv6/addr.h
@@ -255,20 +255,6 @@ static inline bool ng_ipv6_addr_is_loopback(const ng_ipv6_addr_t *addr)
(byteorder_ntohll(addr->u64[1]) == 1);
}
-/**
- * @brief Check if @p addr is global unicast address.
- *
- * @see
- * RFC 4291, section 2.5.4
- *
- *
- * @param[in] addr An IPv6 address.
- *
- * @return true, if @p addr is global unicast address,
- * @return false, otherwise.
- */
-bool ng_ipv6_addr_is_global_unicast(const ng_ipv6_addr_t *addr);
-
/**
* @brief Checks if @p addr is a IPv4-compatible IPv6 address.
*
@@ -386,6 +372,38 @@ static inline bool ng_ipv6_addr_is_unique_local_unicast(const ng_ipv6_addr_t *ad
return ((addr->u8[0] == 0xfc) || (addr->u8[0] == 0xfd));
}
+/**
+ * @brief Check if @p addr is global unicast address.
+ *
+ * @see
+ * RFC 4291, section 2.5.4
+ *
+ *
+ * @param[in] addr An IPv6 address.
+ *
+ * @return true, if @p addr is global unicast address,
+ * @return false, otherwise.
+ */
+static inline bool ng_ipv6_addr_is_global(const ng_ipv6_addr_t *addr)
+{
+ /* first check for multicast with global scope */
+ if (ng_ipv6_addr_is_multicast(addr)) {
+ return ((addr->u8[1] & 0x0f) == NG_IPV6_ADDR_MCAST_SCP_GLOBAL);
+ }
+ else {
+ /* for unicast check if: */
+ /* - not unspecific or loopback */
+ return (!((addr->u64[0].u64 == 0) &&
+ ((byteorder_ntohll(addr->u64[1]) & (0xfffffffffffffffe)) == 0)) &&
+ /* - not link-local */
+ (byteorder_ntohll(addr->u64[0]) != 0xfe80000000000000) &&
+ /* - not site-local */
+ ((byteorder_ntohs(addr->u16[0]) & 0xffc0) !=
+ NG_IPV6_ADDR_SITE_LOCAL_PREFIX));
+ }
+}
+
+
/**
* @brief Check if @p addr is solicited-node multicast address.
*
diff --git a/sys/net/network_layer/ng_ipv6/addr/ng_ipv6_addr.c b/sys/net/network_layer/ng_ipv6/addr/ng_ipv6_addr.c
index d5a994e7ab..dbd9dc6073 100644
--- a/sys/net/network_layer/ng_ipv6/addr/ng_ipv6_addr.c
+++ b/sys/net/network_layer/ng_ipv6/addr/ng_ipv6_addr.c
@@ -77,20 +77,6 @@ void ng_ipv6_addr_init_prefix(ng_ipv6_addr_t *out, const ng_ipv6_addr_t *prefix,
out->u8[bytes] |= (prefix->u8[bytes] & mask);
}
}
-
-
-bool ng_ipv6_addr_is_global_unicast(const ng_ipv6_addr_t *addr)
-{
- return (!(ng_ipv6_addr_is_unique_local_unicast(addr)) &&
- !(ng_ipv6_addr_is_unspecified(addr)) &&
- !(ng_ipv6_addr_is_loopback(addr)) &&
- !(ng_ipv6_addr_is_ipv4_compat(addr)) &&
- !(ng_ipv6_addr_is_ipv4_mapped(addr)) &&
- !(ng_ipv6_addr_is_site_local(addr)) &&
- !(ng_ipv6_addr_is_link_local(addr)) &&
- !(ng_ipv6_addr_is_multicast(addr)));
-}
-
/**
* @}
*/