summaryrefslogtreecommitdiffstats
path: root/src/chain.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-06-10 14:13:00 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-06-15 12:12:38 +0200
commit844541f4c43c2469b9955b78480cbe36fde653d0 (patch)
tree0c5238784698f46c4166596b5487abace0646145 /src/chain.c
parent396cdb2375af8c8b8884f5f50c773a39b29a06d7 (diff)
src: assert when setting unknown attributes
If this attribute is not supported by the library, we should rise an assertion so the client knows something is wrong, instead of silently going through. The only case I can think may hit this problem is version mismatch between library and tools. This should not ever really happen, so better bail out from the library itself in this case. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/chain.c')
-rw-r--r--src/chain.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/chain.c b/src/chain.c
index 990c576..c7a9597 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -168,9 +168,7 @@ static uint32_t nftnl_chain_validate[NFTNL_CHAIN_MAX + 1] = {
void nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
const void *data, uint32_t data_len)
{
- if (attr > NFTNL_CHAIN_MAX)
- return;
-
+ nftnl_assert_attr_exists(attr, NFTNL_CHAIN_MAX);
nftnl_assert_validate(data, nftnl_chain_validate, attr, data_len);
switch(attr) {