[ovs-dev] [RFC PATCH 3/7] lib: add ipv6 helper functions

Thadeu Lima de Souza Cascardo cascardo at redhat.com
Tue Sep 29 22:10:54 UTC 2015


From: Jiri Benc <jbenc at redhat.com>

ipv6_addr_is_set is going to be used by next patches.

[cascardo: compare with in6addr_any in ipv6_addr_is_set]
[cascardo: keep only ipv6_addr_is_* functions]

Signed-off-by: Jiri Benc <jbenc at redhat.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at redhat.com>
---
 lib/packets.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/packets.h b/lib/packets.h
index d55c718..e841fb1 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -871,6 +871,14 @@ static inline bool ipv6_is_all_hosts(const struct in6_addr *addr) {
     return ipv6_addr_equals(addr, &in6addr_all_hosts);
 }
 
+static inline bool ipv6_addr_is_set(const struct in6_addr *addr) {
+    return !ipv6_addr_equals(addr, &in6addr_any);
+}
+
+static inline bool ipv6_addr_is_multicast(const struct in6_addr *ip) {
+    return ip->s6_addr[0] == 0xff;
+}
+
 static inline void
 in6_addr_set_mapped_ipv4(struct in6_addr *addr, ovs_be32 ip4)
 {
-- 
2.4.3




More information about the dev mailing list