Revert NFTSet feature
This reverts PR #22587 and its follow-up commit. More specifically,
2299b1cae3 (partially),
e176f855278d5098d3fecc5aa24ba702147d42e0,
ceb46a31a01b3d3d1d6095d857e29ea214a2776b, and
51bb9076ab8c050bebb64db5035852385accda35.
The PR was merged without final approval, and has several issues:
- OSS fuzz reported issues in the conf parser,
- It calls synchrnous netlink call, it should not be especially in PID1,
- The importance of NFTSet for CGroup and DynamicUser may be
questionable, at least, there was no justification PID1 should support
it.
- For networkd, it should be implemented with Request object,
- There is no test for the feature.
Fixes #23711.
Fixes #23717.
Fixes #23719.
Fixes #23720.
Fixes #23721.
Fixes #23759.
This commit is contained in:
@@ -672,9 +672,6 @@ tests += [
|
||||
[files('test-hmac.c')],
|
||||
|
||||
[files('test-sha256.c')],
|
||||
|
||||
[files('test-nft-set.c'),
|
||||
[], [], [], '', 'manual'],
|
||||
]
|
||||
|
||||
############################################################
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "firewall-util.h"
|
||||
#include "in-addr-util.h"
|
||||
#include "log.h"
|
||||
#include "parse-util.h"
|
||||
#include "string-util.h"
|
||||
#include "tests.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int r;
|
||||
|
||||
assert_se(argc == 7);
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
if (getuid() != 0)
|
||||
return log_tests_skipped("not root");
|
||||
|
||||
int nfproto;
|
||||
nfproto = nfproto_from_string(argv[2]);
|
||||
assert_se(nfproto > 0);
|
||||
|
||||
const NFTSetContext nft_set_context = {
|
||||
.nfproto = nfproto,
|
||||
.table = argv[3],
|
||||
.set = argv[4],
|
||||
};
|
||||
|
||||
if (streq(argv[5], "uint32")) {
|
||||
uint32_t element;
|
||||
r = safe_atou32(argv[6], &element);
|
||||
assert_se(r == 0);
|
||||
|
||||
if (streq(argv[1], "add"))
|
||||
r = nft_set_element_add_uint32(&nft_set_context, element);
|
||||
else
|
||||
r = nft_set_element_del_uint32(&nft_set_context, element);
|
||||
assert_se(r == 0);
|
||||
} else if (streq(argv[5], "uint64")) {
|
||||
uint64_t element;
|
||||
r = safe_atou64(argv[6], &element);
|
||||
assert_se(r == 0);
|
||||
|
||||
if (streq(argv[1], "add"))
|
||||
r = nft_set_element_add_uint64(&nft_set_context, element);
|
||||
else
|
||||
r = nft_set_element_del_uint64(&nft_set_context, element);
|
||||
assert_se(r == 0);
|
||||
} else {
|
||||
union in_addr_union addr;
|
||||
int af;
|
||||
unsigned char prefixlen;
|
||||
|
||||
r = in_addr_prefix_from_string_auto(argv[6], &af, &addr, &prefixlen);
|
||||
assert_se(r == 0);
|
||||
|
||||
if (streq(argv[1], "add"))
|
||||
r = nft_set_element_add_in_addr(&nft_set_context, af, &addr, prefixlen);
|
||||
else
|
||||
r = nft_set_element_del_in_addr(&nft_set_context, af, &addr, prefixlen);
|
||||
assert_se(r == 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user