render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
500572
From: Martin Kletzander <mkletzan@redhat.com>
500572
Date: Fri, 16 Aug 2024 13:56:51 +0200
500572
Subject: [PATCH] virarptable: Properly calculate rtattr length
500572
Content-type: text/plain
500572
500572
Use convenience macro which does almost the same thing we were doing,
500572
but also pads out the payload length to a multiple of NLMSG_ALIGNTO (4)
500572
bytes.
500572
500572
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
500572
Reviewed-by: Laine Stump <laine@redhat.com>
500572
---
500572
 src/util/virarptable.c | 3 +--
500572
 1 file changed, 1 insertion(+), 2 deletions(-)
500572
500572
diff --git a/src/util/virarptable.c b/src/util/virarptable.c
500572
index 299dddd664..d8e41c5a86 100644
500572
--- a/src/util/virarptable.c
500572
+++ b/src/util/virarptable.c
500572
@@ -102,8 +102,7 @@ virArpTableGet(void)
500572
             return table;
500572
 
500572
         VIR_WARNINGS_NO_CAST_ALIGN
500572
-        parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
500572
-                     nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
500572
+        parse_rtattr(tb, NDA_MAX, NDA_RTA(r), NLMSG_PAYLOAD(nh, sizeof(*r)));
500572
         VIR_WARNINGS_RESET
500572
 
500572
         if (tb[NDA_DST] == NULL || tb[NDA_LLADDR] == NULL)