summaryrefslogtreecommitdiffstats
path: root/lib/ipaddr.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/ipaddr.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/ipaddr.h b/lib/ipaddr.h
index c86e38c..888955f 100644
--- a/lib/ipaddr.h
+++ b/lib/ipaddr.h
@@ -40,8 +40,9 @@ struct ipaddr {
#define IS_IPADDR_V4(p) ((p)->ipa_type == IPADDR_V4)
#define IS_IPADDR_V6(p) ((p)->ipa_type == IPADDR_V6)
-#define SET_IPADDR_V4(p) (p)->ipa_type = IPADDR_V4
-#define SET_IPADDR_V6(p) (p)->ipa_type = IPADDR_V6
+#define SET_IPADDR_NONE(p) ((p)->ipa_type = IPADDR_NONE)
+#define SET_IPADDR_V4(p) ((p)->ipa_type = IPADDR_V4)
+#define SET_IPADDR_V6(p) ((p)->ipa_type = IPADDR_V6)
#define IPADDRSZ(p) \
(IS_IPADDR_V4((p)) ? sizeof(struct in_addr) : sizeof(struct in6_addr))
@@ -165,9 +166,17 @@ static inline bool ipaddr_is_zero(const struct ipaddr *ip)
return true;
}
+static inline bool ipaddr_is_same(const struct ipaddr *ip1,
+ const struct ipaddr *ip2)
+{
+ return ipaddr_cmp(ip1, ip2) == 0;
+}
+
+/* clang-format off */
#ifdef _FRR_ATTRIBUTE_PRINTFRR
#pragma FRR printfrr_ext "%pIA" (struct ipaddr *)
#endif
+/* clang-format on */
#ifdef __cplusplus
}