|
|
500572 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
500572 |
Date: Fri, 16 Aug 2024 14:02:48 +0200
|
|
|
500572 |
Subject: [PATCH] virarptable: End parsing earlier in case of NLMSG_DONE
|
|
|
500572 |
Content-type: text/plain
|
|
|
500572 |
|
|
|
500572 |
Check for the last multipart message right as the first thing. The
|
|
|
500572 |
presumption probably was that the last message might still contain a
|
|
|
500572 |
payload we want to parse. However that cannot be true since that would
|
|
|
500572 |
have to be a type RTM_NEWNEIGH. This was not caught because older
|
|
|
500572 |
kernels were note sending NLMSG_DONE and probably relied on the fact
|
|
|
500572 |
that the parsing just stops after all the messages are walked through,
|
|
|
500572 |
which the NLMSG_OK macro successfully did.
|
|
|
500572 |
|
|
|
500572 |
Resolves: https://issues.redhat.com/browse/RHEL-52449
|
|
|
500572 |
Resolves: https://bugzilla.redhat.com/2302245
|
|
|
500572 |
Fixes: a176d67cdfaf5b8237a7e3a80d8be0e6bdf2d8fd
|
|
|
500572 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
500572 |
Reviewed-by: Laine Stump <laine@redhat.com>
|
|
|
500572 |
---
|
|
|
500572 |
src/util/virarptable.c | 6 +++---
|
|
|
500572 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
500572 |
|
|
|
500572 |
diff --git a/src/util/virarptable.c b/src/util/virarptable.c
|
|
|
500572 |
index 45ee76766f..20d11f97b0 100644
|
|
|
500572 |
--- a/src/util/virarptable.c
|
|
|
500572 |
+++ b/src/util/virarptable.c
|
|
|
500572 |
@@ -83,6 +83,9 @@ virArpTableGet(void)
|
|
|
500572 |
struct ndmsg *r = NLMSG_DATA(nh);
|
|
|
500572 |
void *addr;
|
|
|
500572 |
|
|
|
500572 |
+ if (nh->nlmsg_type == NLMSG_DONE)
|
|
|
500572 |
+ break;
|
|
|
500572 |
+
|
|
|
500572 |
if (nh->nlmsg_len < NLMSG_SPACE(sizeof(*r))) {
|
|
|
500572 |
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
500572 |
_("wrong nlmsg len"));
|
|
|
500572 |
@@ -97,9 +100,6 @@ virArpTableGet(void)
|
|
|
500572 |
(!(r->ndm_state == NUD_STALE || r->ndm_state == NUD_REACHABLE)))
|
|
|
500572 |
continue;
|
|
|
500572 |
|
|
|
500572 |
- if (nh->nlmsg_type == NLMSG_DONE)
|
|
|
500572 |
- return table;
|
|
|
500572 |
-
|
|
|
500572 |
VIR_WARNINGS_NO_CAST_ALIGN
|
|
|
500572 |
parse_rtattr(tb, NDA_MAX, NDA_RTA(r), NLMSG_PAYLOAD(nh, sizeof(*r)));
|
|
|
500572 |
VIR_WARNINGS_RESET
|