summaryrefslogtreecommitdiffstats
path: root/vrrpd/vrrp_northbound.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2022-01-27 19:05:40 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2022-01-27 19:05:40 +0100
commit3448a75c9d2d23a36006267c20f102fd7afaaf92 (patch)
tree3074e36ca0378c0652931ac0ff3929be8fe624ba /vrrpd/vrrp_northbound.c
parentMerge pull request #9880 from louis-oui/maximum-prefix-out (diff)
downloadfrr-3448a75c9d2d23a36006267c20f102fd7afaaf92.tar.xz
frr-3448a75c9d2d23a36006267c20f102fd7afaaf92.zip
vrrpd: use ipaddr_is_zero when needed
Replace custom implementation or call to ipaddr_isset with a call to ipaddr_is_zero. ipaddr_isset is not fully correct, because it's fine to have some non-zero bytes at the end of the struct in case of IPv4 and the function doesn't allow that. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'vrrpd/vrrp_northbound.c')
-rw-r--r--vrrpd/vrrp_northbound.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/vrrpd/vrrp_northbound.c b/vrrpd/vrrp_northbound.c
index f814963fe..d25dc0a19 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;