|
|
763a55 |
From 6854ec003b42cf02d4b40c0942d49ede9f6d94c0 Mon Sep 17 00:00:00 2001
|
|
|
763a55 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
763a55 |
Date: Wed, 19 Feb 2020 12:00:31 +0100
|
|
|
763a55 |
Subject: [PATCH] src: Fix for reading garbage in nftnl_chain getters
|
|
|
763a55 |
|
|
|
763a55 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1758673
|
|
|
763a55 |
Upstream Status: libnftnl commit 629ee38dca486
|
|
|
763a55 |
|
|
|
763a55 |
commit 629ee38dca48651bc8c0eedf2f3a0066a6c0aa5b
|
|
|
763a55 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
763a55 |
Date: Fri Feb 14 18:20:29 2020 +0100
|
|
|
763a55 |
|
|
|
763a55 |
src: Fix for reading garbage in nftnl_chain getters
|
|
|
763a55 |
|
|
|
763a55 |
In {s,u}{32,64} type getters nftnl_assert() is called to make sure
|
|
|
763a55 |
returned data length matches expectations. Therefore all attributes must
|
|
|
763a55 |
set data_len, which NFTNL_CHAIN_DEVICES didn't.
|
|
|
763a55 |
|
|
|
763a55 |
While being at it, do the same change for NFTNL_FLOWTABLE_DEVICES as
|
|
|
763a55 |
well to make code a bit more consistent although the problem was fixed
|
|
|
763a55 |
for flowtables with commit f8eed54150fd4 ("flowtable: Fix for reading
|
|
|
763a55 |
garbage") already (but in the other direction).
|
|
|
763a55 |
|
|
|
763a55 |
Fixes: e3ac19b5ec162 ("chain: multi-device support")
|
|
|
763a55 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
763a55 |
---
|
|
|
763a55 |
src/chain.c | 1 +
|
|
|
763a55 |
src/flowtable.c | 1 +
|
|
|
763a55 |
2 files changed, 2 insertions(+)
|
|
|
763a55 |
|
|
|
763a55 |
diff --git a/src/chain.c b/src/chain.c
|
|
|
763a55 |
index b9a16fc..6e90763 100644
|
|
|
763a55 |
--- a/src/chain.c
|
|
|
763a55 |
+++ b/src/chain.c
|
|
|
763a55 |
@@ -365,6 +365,7 @@ const void *nftnl_chain_get_data(const struct nftnl_chain *c, uint16_t attr,
|
|
|
763a55 |
*data_len = strlen(c->dev) + 1;
|
|
|
763a55 |
return c->dev;
|
|
|
763a55 |
case NFTNL_CHAIN_DEVICES:
|
|
|
763a55 |
+ *data_len = 0;
|
|
|
763a55 |
return &c->dev_array[0];
|
|
|
763a55 |
}
|
|
|
763a55 |
return NULL;
|
|
|
763a55 |
diff --git a/src/flowtable.c b/src/flowtable.c
|
|
|
763a55 |
index 9ba3b6d..bf3e443 100644
|
|
|
763a55 |
--- a/src/flowtable.c
|
|
|
763a55 |
+++ b/src/flowtable.c
|
|
|
763a55 |
@@ -231,6 +231,7 @@ const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c,
|
|
|
763a55 |
*data_len = sizeof(int32_t);
|
|
|
763a55 |
return &c->family;
|
|
|
763a55 |
case NFTNL_FLOWTABLE_DEVICES:
|
|
|
763a55 |
+ *data_len = 0;
|
|
|
763a55 |
return &c->dev_array[0];
|
|
|
763a55 |
case NFTNL_FLOWTABLE_SIZE:
|
|
|
763a55 |
*data_len = sizeof(int32_t);
|
|
|
763a55 |
--
|
|
|
763a55 |
1.8.3.1
|
|
|
763a55 |
|