From: Martin Kletzander Date: Fri, 16 Aug 2024 11:56:51 +0000 (+0200) Subject: virarptable: Properly calculate rtattr length X-Git-Tag: v10.7.0-rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7530769e879199fc6003a8a44da3a441d40c461;p=thirdparty%2Flibvirt.git virarptable: Properly calculate rtattr length Use convenience macro which does almost the same thing we were doing, but also pads out the payload length to a multiple of NLMSG_ALIGNTO (4) bytes. Signed-off-by: Martin Kletzander Reviewed-by: Laine Stump --- diff --git a/src/util/virarptable.c b/src/util/virarptable.c index 299dddd664..d8e41c5a86 100644 --- a/src/util/virarptable.c +++ b/src/util/virarptable.c @@ -102,8 +102,7 @@ virArpTableGet(void) return table; VIR_WARNINGS_NO_CAST_ALIGN - parse_rtattr(tb, NDA_MAX, NDA_RTA(r), - nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); + parse_rtattr(tb, NDA_MAX, NDA_RTA(r), NLMSG_PAYLOAD(nh, sizeof(*r))); VIR_WARNINGS_RESET if (tb[NDA_DST] == NULL || tb[NDA_LLADDR] == NULL)