summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2022-01-27 16:08:15 -0500
committerGitHub <noreply@github.com>2022-01-27 16:08:15 -0500
commit4871e5d5bf2b4f59ffb8f25c307a4a25951df1cd (patch)
tree27d3d364f40d4954004dc6344f8f14921135a8f7
parent13b87d339f87e4f4be8deeb480bae748457c74e4 (diff)
parent3448a75c9d2d23a36006267c20f102fd7afaaf92 (diff)
Merge pull request #10433 from idryzhov/vrrp-ip-addr-is-zero
-rw-r--r--lib/ipaddr.h9
-rw-r--r--vrrpd/vrrp_northbound.c7
2 files changed, 2 insertions, 14 deletions
diff --git a/lib/ipaddr.h b/lib/ipaddr.h
index a334ea969e..d7ab358afe 100644
--- a/lib/ipaddr.h
+++ b/lib/ipaddr.h
@@ -137,15 +137,6 @@ static inline void ipv4_mapped_ipv6_to_ipv4(const struct in6_addr *in6,
}
/*
- * Check if a struct ipaddr has nonzero value
- */
-static inline bool ipaddr_isset(struct ipaddr *ip)
-{
- static struct ipaddr a = {};
- return (0 != memcmp(&a, ip, sizeof(struct ipaddr)));
-}
-
-/*
* generic ordering comparison between IP addresses
*/
static inline int ipaddr_cmp(const struct ipaddr *a, const struct ipaddr *b)
diff --git a/vrrpd/vrrp_northbound.c b/vrrpd/vrrp_northbound.c
index f814963fe5..d25dc0a197 100644
--- a/vrrpd/vrrp_northbound.c
+++ b/vrrpd/vrrp_northbound.c
@@ -246,11 +246,8 @@ lib_interface_vrrp_vrrp_group_v4_source_address_get_elem(
{
const struct vrrp_vrouter *vr = args->list_entry;
struct yang_data *val = NULL;
- struct ipaddr ip;
-
- memset(&ip, 0x00, sizeof(ip));
- if (memcmp(&vr->v4->src.ipaddr_v4, &ip.ipaddr_v4, sizeof(ip.ipaddr_v4)))
+ if (!ipaddr_is_zero(&vr->v4->src))
val = yang_data_new_ip(args->xpath, &vr->v4->src);
return val;
@@ -410,7 +407,7 @@ lib_interface_vrrp_vrrp_group_v6_source_address_get_elem(
const struct vrrp_vrouter *vr = args->list_entry;
struct yang_data *val = NULL;
- if (ipaddr_isset(&vr->v6->src))
+ if (!ipaddr_is_zero(&vr->v6->src))
val = yang_data_new_ip(args->xpath, &vr->v6->src);
return val;