2018-01-28 20:42:46 +01:00
|
|
|
From a51cdce6fd271a5cc393c5e56996846d9c453d6a Mon Sep 17 00:00:00 2001
|
2014-12-29 15:38:14 +01:00
|
|
|
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
2016-06-04 03:11:30 +02:00
|
|
|
Date: Thu, 2 Jun 2016 23:03:27 -0300
|
|
|
|
Subject: [PATCH] Rename xfree() to libnftnl_xfree() to avoid symbol naming
|
2014-12-29 15:38:14 +01:00
|
|
|
conflict
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
When ELF binaries and shared libraries are used, the internal
|
|
|
|
functions of libnftnl such as xfree() are not visible to the outside
|
|
|
|
world (their visibility is 'hidden'). Therefore, the fact that other
|
|
|
|
programs (especially nftables) may have symbols with the same name
|
|
|
|
does not cause any problem.
|
|
|
|
|
|
|
|
However, when doing static linking on a non-ELF platform (such as
|
|
|
|
Blackfin, which uses the FLAT binary format), there is no way of
|
|
|
|
encoding this visibility. Therefore, the xfree() symbols of libnftnl
|
|
|
|
becomes visible to the outside world, causing a conflict with the
|
|
|
|
xfree() symbol defined by nftables.
|
|
|
|
|
|
|
|
To solve this, this patch renames the libnftnl xfree() function to
|
|
|
|
libnftnl_xfree().
|
|
|
|
|
|
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
2016-12-21 15:47:10 +01:00
|
|
|
[Gustavo: update for version 1.0.7]
|
2016-06-04 03:11:30 +02:00
|
|
|
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
2018-01-28 20:42:46 +01:00
|
|
|
[baruch: update for version 1.0.9]
|
|
|
|
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
|
2014-12-29 15:38:14 +01:00
|
|
|
---
|
2015-10-02 16:20:59 +02:00
|
|
|
include/utils.h | 2 +-
|
2016-12-21 15:47:10 +01:00
|
|
|
src/chain.c | 36 ++++++++++++++++++------------------
|
2014-12-29 15:38:14 +01:00
|
|
|
src/common.c | 2 +-
|
2015-10-02 16:20:59 +02:00
|
|
|
src/expr.c | 4 ++--
|
2016-12-21 15:47:10 +01:00
|
|
|
src/expr/data_reg.c | 2 +-
|
2016-06-04 03:11:30 +02:00
|
|
|
src/expr/dynset.c | 2 +-
|
2014-12-29 15:38:14 +01:00
|
|
|
src/expr/immediate.c | 2 +-
|
|
|
|
src/expr/log.c | 6 +++---
|
2016-06-04 03:11:30 +02:00
|
|
|
src/expr/lookup.c | 2 +-
|
2014-12-29 15:38:14 +01:00
|
|
|
src/expr/match.c | 6 +++---
|
|
|
|
src/expr/target.c | 6 +++---
|
|
|
|
src/gen.c | 2 +-
|
2016-12-21 15:47:10 +01:00
|
|
|
src/object.c | 14 +++++++-------
|
|
|
|
src/rule.c | 32 ++++++++++++++++----------------
|
2014-12-29 15:38:14 +01:00
|
|
|
src/ruleset.c | 2 +-
|
2018-01-28 20:42:46 +01:00
|
|
|
src/set.c | 28 ++++++++++++++--------------
|
2016-12-21 15:47:10 +01:00
|
|
|
src/set_elem.c | 28 ++++++++++++++--------------
|
2015-10-02 16:20:59 +02:00
|
|
|
src/table.c | 14 +++++++-------
|
2016-06-04 03:11:30 +02:00
|
|
|
src/trace.c | 14 +++++++-------
|
|
|
|
src/udata.c | 2 +-
|
2014-12-29 15:38:14 +01:00
|
|
|
src/utils.c | 2 +-
|
2018-01-28 20:42:46 +01:00
|
|
|
21 files changed, 104 insertions(+), 104 deletions(-)
|
2014-12-29 15:38:14 +01:00
|
|
|
|
2015-10-02 16:20:59 +02:00
|
|
|
diff --git a/include/utils.h b/include/utils.h
|
2018-01-28 20:42:46 +01:00
|
|
|
index 3cc659652fe2..820556715013 100644
|
2015-10-02 16:20:59 +02:00
|
|
|
--- a/include/utils.h
|
|
|
|
+++ b/include/utils.h
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -17,7 +17,7 @@
|
2015-10-02 16:20:59 +02:00
|
|
|
|
|
|
|
#define __noreturn __attribute__((__noreturn__))
|
|
|
|
|
|
|
|
-#define xfree(ptr) free((void *)ptr);
|
|
|
|
+#define nftnl_xfree(ptr) free((void *)ptr);
|
|
|
|
|
|
|
|
#define div_round_up(n, d) (((n) + (d) - 1) / (d))
|
|
|
|
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/chain.c b/src/chain.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index eff518680873..03033bbcb93b 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/chain.c
|
|
|
|
+++ b/src/chain.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -97,14 +97,14 @@ EXPORT_SYMBOL(nftnl_chain_free);
|
2016-06-04 03:11:30 +02:00
|
|
|
void nftnl_chain_free(const struct nftnl_chain *c)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_NAME))
|
|
|
|
- xfree(c->name);
|
|
|
|
+ nftnl_xfree(c->name);
|
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_TABLE))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(c->table);
|
|
|
|
+ nftnl_xfree(c->table);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_TYPE))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(c->type);
|
|
|
|
+ nftnl_xfree(c->type);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_DEV))
|
2015-10-02 16:20:59 +02:00
|
|
|
- xfree(c->dev);
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(c);
|
2016-12-21 15:47:10 +01:00
|
|
|
+ nftnl_xfree(c->dev);
|
2014-08-16 15:35:48 +02:00
|
|
|
+ nftnl_xfree(c);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_chain_is_set);
|
|
|
|
@@ -121,15 +121,15 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
|
2014-08-16 15:35:48 +02:00
|
|
|
switch (attr) {
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_CHAIN_NAME:
|
|
|
|
- xfree(c->name);
|
|
|
|
+ nftnl_xfree(c->name);
|
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_CHAIN_TABLE:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(c->table);
|
|
|
|
+ nftnl_xfree(c->table);
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_CHAIN_USE:
|
2014-12-16 12:42:57 +01:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_CHAIN_TYPE:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(c->type);
|
|
|
|
+ nftnl_xfree(c->type);
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_CHAIN_HOOKNUM:
|
|
|
|
case NFTNL_CHAIN_PRIO:
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -140,7 +140,7 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_CHAIN_FAMILY:
|
2015-10-02 16:20:59 +02:00
|
|
|
break;
|
|
|
|
case NFTNL_CHAIN_DEV:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(c->dev);
|
|
|
|
+ nftnl_xfree(c->dev);
|
2015-10-02 16:20:59 +02:00
|
|
|
break;
|
2016-12-21 15:47:10 +01:00
|
|
|
default:
|
|
|
|
return;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -169,7 +169,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
|
2016-12-21 15:47:10 +01:00
|
|
|
switch(attr) {
|
|
|
|
case NFTNL_CHAIN_NAME:
|
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_NAME))
|
|
|
|
- xfree(c->name);
|
|
|
|
+ nftnl_xfree(c->name);
|
|
|
|
|
|
|
|
c->name = strdup(data);
|
|
|
|
if (!c->name)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -177,7 +177,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_CHAIN_TABLE:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_TABLE))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(c->table);
|
|
|
|
+ nftnl_xfree(c->table);
|
|
|
|
|
|
|
|
c->table = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!c->table)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -209,7 +209,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_CHAIN_TYPE:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_TYPE))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(c->type);
|
|
|
|
+ nftnl_xfree(c->type);
|
|
|
|
|
|
|
|
c->type = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!c->type)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -217,7 +217,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_CHAIN_DEV:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_DEV))
|
2015-10-02 16:20:59 +02:00
|
|
|
- xfree(c->dev);
|
|
|
|
+ nftnl_xfree(c->dev);
|
|
|
|
|
|
|
|
c->dev = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!c->dev)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -541,7 +541,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
|
2016-12-21 15:47:10 +01:00
|
|
|
|
|
|
|
if (tb[NFTA_CHAIN_NAME]) {
|
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_NAME))
|
|
|
|
- xfree(c->name);
|
|
|
|
+ nftnl_xfree(c->name);
|
|
|
|
c->name = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_NAME]));
|
|
|
|
if (!c->name)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -549,7 +549,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
|
2015-10-02 16:20:59 +02:00
|
|
|
}
|
|
|
|
if (tb[NFTA_CHAIN_TABLE]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_TABLE))
|
|
|
|
- xfree(c->table);
|
|
|
|
+ nftnl_xfree(c->table);
|
2015-10-02 16:20:59 +02:00
|
|
|
c->table = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TABLE]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!c->table)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -579,7 +579,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
|
2015-10-02 16:20:59 +02:00
|
|
|
}
|
|
|
|
if (tb[NFTA_CHAIN_TYPE]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (c->flags & (1 << NFTNL_CHAIN_TYPE))
|
|
|
|
- xfree(c->type);
|
|
|
|
+ nftnl_xfree(c->type);
|
2015-10-02 16:20:59 +02:00
|
|
|
c->type = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TYPE]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!c->type)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -902,7 +902,7 @@ void nftnl_chain_list_free(struct nftnl_chain_list *list)
|
2014-08-16 15:35:48 +02:00
|
|
|
list_del(&r->head);
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_chain_free(r);
|
2014-08-16 15:35:48 +02:00
|
|
|
}
|
|
|
|
- xfree(list);
|
|
|
|
+ nftnl_xfree(list);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_chain_list_is_empty);
|
|
|
|
@@ -988,5 +988,5 @@ struct nftnl_chain *nftnl_chain_list_iter_next(struct nftnl_chain_list_iter *ite
|
|
|
|
EXPORT_SYMBOL(nftnl_chain_list_iter_destroy);
|
2015-10-02 16:20:59 +02:00
|
|
|
void nftnl_chain_list_iter_destroy(struct nftnl_chain_list_iter *iter)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
|
|
|
- xfree(iter);
|
|
|
|
+ nftnl_xfree(iter);
|
|
|
|
}
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/common.c b/src/common.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 561c95439114..d0124134ea29 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/common.c
|
|
|
|
+++ b/src/common.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -68,7 +68,7 @@ struct nftnl_parse_err *nftnl_parse_err_alloc(void)
|
|
|
|
EXPORT_SYMBOL(nftnl_parse_err_free);
|
2015-10-02 16:20:59 +02:00
|
|
|
void nftnl_parse_err_free(struct nftnl_parse_err *err)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
|
|
|
- xfree(err);
|
|
|
|
+ nftnl_xfree(err);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_parse_perror);
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/expr.c b/src/expr.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 62565e046996..97f16275f44f 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/expr.c
|
|
|
|
+++ b/src/expr.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -51,7 +51,7 @@ void nftnl_expr_free(const struct nftnl_expr *expr)
|
2014-12-29 15:38:14 +01:00
|
|
|
if (expr->ops->free)
|
|
|
|
expr->ops->free(expr);
|
|
|
|
|
|
|
|
- xfree(expr);
|
|
|
|
+ nftnl_xfree(expr);
|
|
|
|
}
|
2015-10-02 16:20:59 +02:00
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_expr_is_set);
|
2016-12-21 15:47:10 +01:00
|
|
|
@@ -270,7 +270,7 @@ struct nftnl_expr *nftnl_expr_parse(struct nlattr *attr)
|
2015-10-02 16:20:59 +02:00
|
|
|
return expr;
|
2014-12-29 15:38:14 +01:00
|
|
|
|
2015-10-02 16:20:59 +02:00
|
|
|
err2:
|
|
|
|
- xfree(expr);
|
|
|
|
+ nftnl_xfree(expr);
|
|
|
|
err1:
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 1b28b291617b..8c7abdb91d21 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/expr/data_reg.c
|
|
|
|
+++ b/src/expr/data_reg.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -379,7 +379,7 @@ void nftnl_free_verdict(const union nftnl_data_reg *data)
|
2015-10-02 16:20:59 +02:00
|
|
|
switch(data->verdict) {
|
|
|
|
case NFT_JUMP:
|
|
|
|
case NFT_GOTO:
|
|
|
|
- xfree(data->chain);
|
|
|
|
+ nftnl_xfree(data->chain);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2016-06-04 03:11:30 +02:00
|
|
|
diff --git a/src/expr/dynset.c b/src/expr/dynset.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 160d0e15c151..614124d841c7 100644
|
2016-06-04 03:11:30 +02:00
|
|
|
--- a/src/expr/dynset.c
|
|
|
|
+++ b/src/expr/dynset.c
|
2016-12-21 15:47:10 +01:00
|
|
|
@@ -330,7 +330,7 @@ static void nftnl_expr_dynset_free(const struct nftnl_expr *e)
|
2016-06-04 03:11:30 +02:00
|
|
|
{
|
|
|
|
struct nftnl_expr_dynset *dynset = nftnl_expr_data(e);
|
|
|
|
|
|
|
|
- xfree(dynset->set_name);
|
|
|
|
+ nftnl_xfree(dynset->set_name);
|
|
|
|
}
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
static bool nftnl_expr_dynset_cmp(const struct nftnl_expr *e1,
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/expr/immediate.c b/src/expr/immediate.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index b0570bd539a4..6a0732c38ebd 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/expr/immediate.c
|
|
|
|
+++ b/src/expr/immediate.c
|
2015-10-02 16:20:59 +02:00
|
|
|
@@ -44,7 +44,7 @@ nftnl_expr_immediate_set(struct nftnl_expr *e, uint16_t type,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_EXPR_IMM_CHAIN:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (e->flags & (1 << NFTNL_EXPR_IMM_CHAIN))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(imm->data.chain);
|
|
|
|
+ nftnl_xfree(imm->data.chain);
|
|
|
|
|
|
|
|
imm->data.chain = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!imm->data.chain)
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/expr/log.c b/src/expr/log.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 86d965136cd4..0624a7712237 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/expr/log.c
|
|
|
|
+++ b/src/expr/log.c
|
2016-12-21 15:47:10 +01:00
|
|
|
@@ -39,7 +39,7 @@ static int nftnl_expr_log_set(struct nftnl_expr *e, uint16_t type,
|
2014-08-16 15:35:48 +02:00
|
|
|
switch(type) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_EXPR_LOG_PREFIX:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (log->flags & (1 << NFTNL_EXPR_LOG_PREFIX))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(log->prefix);
|
|
|
|
+ nftnl_xfree(log->prefix);
|
|
|
|
|
|
|
|
log->prefix = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!log->prefix)
|
|
|
|
@@ -155,7 +155,7 @@ nftnl_expr_log_parse(struct nftnl_expr *e, struct nlattr *attr)
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
if (tb[NFTA_LOG_PREFIX]) {
|
|
|
|
if (log->prefix)
|
|
|
|
- xfree(log->prefix);
|
|
|
|
+ nftnl_xfree(log->prefix);
|
|
|
|
|
|
|
|
log->prefix = strdup(mnl_attr_get_str(tb[NFTA_LOG_PREFIX]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!log->prefix)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -317,7 +317,7 @@ static void nftnl_expr_log_free(const struct nftnl_expr *e)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
2015-10-02 16:20:59 +02:00
|
|
|
struct nftnl_expr_log *log = nftnl_expr_data(e);
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
- xfree(log->prefix);
|
|
|
|
+ nftnl_xfree(log->prefix);
|
|
|
|
}
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
static bool nftnl_expr_log_cmp(const struct nftnl_expr *e1,
|
2016-06-04 03:11:30 +02:00
|
|
|
diff --git a/src/expr/lookup.c b/src/expr/lookup.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 5fcb81f3a7a2..45f5dfefd33f 100644
|
2016-06-04 03:11:30 +02:00
|
|
|
--- a/src/expr/lookup.c
|
|
|
|
+++ b/src/expr/lookup.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -258,7 +258,7 @@ static void nftnl_expr_lookup_free(const struct nftnl_expr *e)
|
2016-06-04 03:11:30 +02:00
|
|
|
{
|
|
|
|
struct nftnl_expr_lookup *lookup = nftnl_expr_data(e);
|
|
|
|
|
|
|
|
- xfree(lookup->set_name);
|
|
|
|
+ nftnl_xfree(lookup->set_name);
|
|
|
|
}
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
static bool nftnl_expr_lookup_cmp(const struct nftnl_expr *e1,
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/expr/match.c b/src/expr/match.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index dd09e1e85192..09e35c528aca 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/expr/match.c
|
|
|
|
+++ b/src/expr/match.c
|
2015-10-02 16:20:59 +02:00
|
|
|
@@ -50,7 +50,7 @@ nftnl_expr_match_set(struct nftnl_expr *e, uint16_t type,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_EXPR_MT_INFO:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (e->flags & (1 << NFTNL_EXPR_MT_INFO))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(mt->data);
|
|
|
|
+ nftnl_xfree(mt->data);
|
|
|
|
|
|
|
|
mt->data = data;
|
|
|
|
mt->data_len = data_len;
|
2015-10-02 16:20:59 +02:00
|
|
|
@@ -147,7 +147,7 @@ static int nftnl_expr_match_parse(struct nftnl_expr *e, struct nlattr *attr)
|
2014-08-16 15:35:48 +02:00
|
|
|
void *match_data;
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
if (e->flags & (1 << NFTNL_EXPR_MT_INFO))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(match->data);
|
|
|
|
+ nftnl_xfree(match->data);
|
|
|
|
|
|
|
|
match_data = calloc(1, len);
|
|
|
|
if (match_data == NULL)
|
2016-12-21 15:47:10 +01:00
|
|
|
@@ -217,7 +217,7 @@ static void nftnl_expr_match_free(const struct nftnl_expr *e)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
2015-10-02 16:20:59 +02:00
|
|
|
struct nftnl_expr_match *match = nftnl_expr_data(e);
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
- xfree(match->data);
|
|
|
|
+ nftnl_xfree(match->data);
|
|
|
|
}
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
static bool nftnl_expr_match_cmp(const struct nftnl_expr *e1,
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/expr/target.c b/src/expr/target.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index ed4bf7df6328..5e28925debeb 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/expr/target.c
|
|
|
|
+++ b/src/expr/target.c
|
2015-10-02 16:20:59 +02:00
|
|
|
@@ -50,7 +50,7 @@ nftnl_expr_target_set(struct nftnl_expr *e, uint16_t type,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_EXPR_TG_INFO:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (e->flags & (1 << NFTNL_EXPR_TG_INFO))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(tg->data);
|
|
|
|
+ nftnl_xfree(tg->data);
|
|
|
|
|
|
|
|
tg->data = data;
|
|
|
|
tg->data_len = data_len;
|
2015-10-02 16:20:59 +02:00
|
|
|
@@ -147,7 +147,7 @@ static int nftnl_expr_target_parse(struct nftnl_expr *e, struct nlattr *attr)
|
2014-08-16 15:35:48 +02:00
|
|
|
void *target_data;
|
|
|
|
|
|
|
|
if (target->data)
|
|
|
|
- xfree(target->data);
|
|
|
|
+ nftnl_xfree(target->data);
|
|
|
|
|
|
|
|
target_data = calloc(1, len);
|
|
|
|
if (target_data == NULL)
|
2016-12-21 15:47:10 +01:00
|
|
|
@@ -217,7 +217,7 @@ static void nftnl_expr_target_free(const struct nftnl_expr *e)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
2015-10-02 16:20:59 +02:00
|
|
|
struct nftnl_expr_target *target = nftnl_expr_data(e);
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
- xfree(target->data);
|
|
|
|
+ nftnl_xfree(target->data);
|
|
|
|
}
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
static bool nftnl_expr_target_cmp(const struct nftnl_expr *e1,
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/gen.c b/src/gen.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index f92180c7baf6..4fe078d3832c 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/gen.c
|
|
|
|
+++ b/src/gen.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -38,7 +38,7 @@ struct nftnl_gen *nftnl_gen_alloc(void)
|
|
|
|
EXPORT_SYMBOL(nftnl_gen_free);
|
2016-06-04 03:11:30 +02:00
|
|
|
void nftnl_gen_free(const struct nftnl_gen *gen)
|
2014-12-16 12:42:57 +01:00
|
|
|
{
|
|
|
|
- xfree(gen);
|
|
|
|
+ nftnl_xfree(gen);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_gen_is_set);
|
2016-12-21 15:47:10 +01:00
|
|
|
diff --git a/src/object.c b/src/object.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 30000f748da4..1b5965d7abdc 100644
|
2016-12-21 15:47:10 +01:00
|
|
|
--- a/src/object.c
|
|
|
|
+++ b/src/object.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -50,11 +50,11 @@ EXPORT_SYMBOL(nftnl_obj_free);
|
2016-12-21 15:47:10 +01:00
|
|
|
void nftnl_obj_free(const struct nftnl_obj *obj)
|
|
|
|
{
|
|
|
|
if (obj->flags & (1 << NFTNL_OBJ_TABLE))
|
|
|
|
- xfree(obj->table);
|
|
|
|
+ nftnl_xfree(obj->table);
|
|
|
|
if (obj->flags & (1 << NFTNL_OBJ_NAME))
|
|
|
|
- xfree(obj->name);
|
|
|
|
+ nftnl_xfree(obj->name);
|
|
|
|
|
|
|
|
- xfree(obj);
|
|
|
|
+ nftnl_xfree(obj);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_obj_is_set);
|
|
|
|
@@ -77,11 +77,11 @@ void nftnl_obj_set_data(struct nftnl_obj *obj, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
switch (attr) {
|
|
|
|
case NFTNL_OBJ_TABLE:
|
|
|
|
- xfree(obj->table);
|
|
|
|
+ nftnl_xfree(obj->table);
|
|
|
|
obj->table = strdup(data);
|
|
|
|
break;
|
|
|
|
case NFTNL_OBJ_NAME:
|
|
|
|
- xfree(obj->name);
|
|
|
|
+ nftnl_xfree(obj->name);
|
|
|
|
obj->name = strdup(data);
|
|
|
|
break;
|
|
|
|
case NFTNL_OBJ_TYPE:
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -523,7 +523,7 @@ void nftnl_obj_list_free(struct nftnl_obj_list *list)
|
2016-12-21 15:47:10 +01:00
|
|
|
list_del(&r->head);
|
|
|
|
nftnl_obj_free(r);
|
|
|
|
}
|
|
|
|
- xfree(list);
|
|
|
|
+ nftnl_xfree(list);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_obj_list_is_empty);
|
|
|
|
@@ -610,5 +610,5 @@ struct nftnl_obj *nftnl_obj_list_iter_next(struct nftnl_obj_list_iter *iter)
|
|
|
|
EXPORT_SYMBOL(nftnl_obj_list_iter_destroy);
|
2016-12-21 15:47:10 +01:00
|
|
|
void nftnl_obj_list_iter_destroy(struct nftnl_obj_list_iter *iter)
|
|
|
|
{
|
|
|
|
- xfree(iter);
|
|
|
|
+ nftnl_xfree(iter);
|
|
|
|
}
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/rule.c b/src/rule.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index e4cba1f7a352..911f327a6f9f 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/rule.c
|
|
|
|
+++ b/src/rule.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -75,13 +75,13 @@ void nftnl_rule_free(const struct nftnl_rule *r)
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_expr_free(e);
|
2014-08-16 15:35:48 +02:00
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << (NFTNL_RULE_TABLE)))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(r->table);
|
|
|
|
+ nftnl_xfree(r->table);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << (NFTNL_RULE_CHAIN)))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(r->chain);
|
|
|
|
+ nftnl_xfree(r->chain);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << (NFTNL_RULE_USERDATA)))
|
2016-06-04 03:11:30 +02:00
|
|
|
- xfree(r->user.data);
|
|
|
|
+ nftnl_xfree(r->user.data);
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
- xfree(r);
|
|
|
|
+ nftnl_xfree(r);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_rule_is_set);
|
|
|
|
@@ -98,10 +98,10 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
|
2014-08-16 15:35:48 +02:00
|
|
|
switch (attr) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_RULE_TABLE:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(r->table);
|
|
|
|
+ nftnl_xfree(r->table);
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_RULE_CHAIN:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(r->chain);
|
|
|
|
+ nftnl_xfree(r->chain);
|
|
|
|
break;
|
|
|
|
case NFTNL_RULE_HANDLE:
|
|
|
|
case NFTNL_RULE_COMPAT_PROTO:
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -111,7 +111,7 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
|
|
|
|
case NFTNL_RULE_ID:
|
2016-12-21 15:47:10 +01:00
|
|
|
break;
|
|
|
|
case NFTNL_RULE_USERDATA:
|
|
|
|
- xfree(r->user.data);
|
|
|
|
+ nftnl_xfree(r->user.data);
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2016-12-21 15:47:10 +01:00
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -137,7 +137,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
switch(attr) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_RULE_TABLE:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << NFTNL_RULE_TABLE))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(r->table);
|
|
|
|
+ nftnl_xfree(r->table);
|
|
|
|
|
|
|
|
r->table = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!r->table)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -145,7 +145,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_RULE_CHAIN:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << NFTNL_RULE_CHAIN))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(r->chain);
|
|
|
|
+ nftnl_xfree(r->chain);
|
|
|
|
|
|
|
|
r->chain = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!r->chain)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -168,7 +168,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
|
2016-06-04 03:11:30 +02:00
|
|
|
break;
|
|
|
|
case NFTNL_RULE_USERDATA:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << NFTNL_RULE_USERDATA))
|
2016-06-04 03:11:30 +02:00
|
|
|
- xfree(r->user.data);
|
|
|
|
+ nftnl_xfree(r->user.data);
|
|
|
|
|
|
|
|
r->user.data = malloc(data_len);
|
|
|
|
if (!r->user.data)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -453,7 +453,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
|
2014-08-16 15:35:48 +02:00
|
|
|
|
2015-10-02 16:20:59 +02:00
|
|
|
if (tb[NFTA_RULE_TABLE]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << NFTNL_RULE_TABLE))
|
|
|
|
- xfree(r->table);
|
|
|
|
+ nftnl_xfree(r->table);
|
2015-10-02 16:20:59 +02:00
|
|
|
r->table = strdup(mnl_attr_get_str(tb[NFTA_RULE_TABLE]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!r->table)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -461,7 +461,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
|
2015-10-02 16:20:59 +02:00
|
|
|
}
|
|
|
|
if (tb[NFTA_RULE_CHAIN]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << NFTNL_RULE_CHAIN))
|
|
|
|
- xfree(r->chain);
|
|
|
|
+ nftnl_xfree(r->chain);
|
2015-10-02 16:20:59 +02:00
|
|
|
r->chain = strdup(mnl_attr_get_str(tb[NFTA_RULE_CHAIN]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!r->chain)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -490,7 +490,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
|
2014-08-16 15:35:48 +02:00
|
|
|
mnl_attr_get_payload(tb[NFTA_RULE_USERDATA]);
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
if (r->flags & (1 << NFTNL_RULE_USERDATA))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(r->user.data);
|
|
|
|
+ nftnl_xfree(r->user.data);
|
|
|
|
|
|
|
|
r->user.len = mnl_attr_get_payload_len(tb[NFTA_RULE_USERDATA]);
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -910,7 +910,7 @@ struct nftnl_expr *nftnl_expr_iter_next(struct nftnl_expr_iter *iter)
|
|
|
|
EXPORT_SYMBOL(nftnl_expr_iter_destroy);
|
2015-10-02 16:20:59 +02:00
|
|
|
void nftnl_expr_iter_destroy(struct nftnl_expr_iter *iter)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
|
|
|
- xfree(iter);
|
|
|
|
+ nftnl_xfree(iter);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_rule_cmp);
|
|
|
|
@@ -971,7 +971,7 @@ void nftnl_rule_list_free(struct nftnl_rule_list *list)
|
2014-08-16 15:35:48 +02:00
|
|
|
list_del(&r->head);
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_rule_free(r);
|
2014-08-16 15:35:48 +02:00
|
|
|
}
|
|
|
|
- xfree(list);
|
|
|
|
+ nftnl_xfree(list);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_rule_list_is_empty);
|
|
|
|
@@ -1063,5 +1063,5 @@ struct nftnl_rule *nftnl_rule_list_iter_next(struct nftnl_rule_list_iter *iter)
|
|
|
|
EXPORT_SYMBOL(nftnl_rule_list_iter_destroy);
|
2016-06-04 03:11:30 +02:00
|
|
|
void nftnl_rule_list_iter_destroy(const struct nftnl_rule_list_iter *iter)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
|
|
|
- xfree(iter);
|
|
|
|
+ nftnl_xfree(iter);
|
|
|
|
}
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/ruleset.c b/src/ruleset.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index eb49fde582c2..1639cae68c61 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/ruleset.c
|
|
|
|
+++ b/src/ruleset.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -72,7 +72,7 @@ void nftnl_ruleset_free(const struct nftnl_ruleset *r)
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_set_list_free(r->set_list);
|
|
|
|
if (r->flags & (1 << NFTNL_RULESET_RULELIST))
|
|
|
|
nftnl_rule_list_free(r->rule_list);
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(r);
|
|
|
|
+ nftnl_xfree(r);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_ruleset_is_set);
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/set.c b/src/set.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index ac24eae6bb16..2b758c4ec89a 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/set.c
|
|
|
|
+++ b/src/set.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -46,17 +46,17 @@ void nftnl_set_free(const struct nftnl_set *s)
|
2015-10-02 16:20:59 +02:00
|
|
|
struct nftnl_set_elem *elem, *tmp;
|
2014-08-16 15:35:48 +02:00
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_TABLE))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(s->table);
|
|
|
|
+ nftnl_xfree(s->table);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_NAME))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(s->name);
|
|
|
|
+ nftnl_xfree(s->name);
|
2018-01-28 20:42:46 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_USERDATA))
|
|
|
|
- xfree(s->user.data);
|
|
|
|
+ nftnl_xfree(s->user.data);
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
list_for_each_entry_safe(elem, tmp, &s->element_list, head) {
|
|
|
|
list_del(&elem->head);
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_set_elem_free(elem);
|
2014-08-16 15:35:48 +02:00
|
|
|
}
|
|
|
|
- xfree(s);
|
|
|
|
+ nftnl_xfree(s);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_set_is_set);
|
|
|
|
@@ -73,10 +73,10 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
|
|
|
|
switch (attr) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_SET_TABLE:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(s->table);
|
|
|
|
+ nftnl_xfree(s->table);
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_SET_NAME:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(s->name);
|
|
|
|
+ nftnl_xfree(s->name);
|
|
|
|
break;
|
|
|
|
case NFTNL_SET_FLAGS:
|
|
|
|
case NFTNL_SET_KEY_TYPE:
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -92,7 +92,7 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_SET_GC_INTERVAL:
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_SET_USERDATA:
|
|
|
|
- xfree(s->user.data);
|
|
|
|
+ nftnl_xfree(s->user.data);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -125,7 +125,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
|
2014-08-16 15:35:48 +02:00
|
|
|
switch(attr) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_SET_TABLE:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_TABLE))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(s->table);
|
|
|
|
+ nftnl_xfree(s->table);
|
|
|
|
|
|
|
|
s->table = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!s->table)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -133,7 +133,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_SET_NAME:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_NAME))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(s->name);
|
|
|
|
+ nftnl_xfree(s->name);
|
|
|
|
|
|
|
|
s->name = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!s->name)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -177,7 +177,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_SET_USERDATA:
|
|
|
|
if (s->flags & (1 << NFTNL_SET_USERDATA))
|
|
|
|
- xfree(s->user.data);
|
|
|
|
+ nftnl_xfree(s->user.data);
|
|
|
|
|
|
|
|
s->user.data = malloc(data_len);
|
|
|
|
if (!s->user.data)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -478,7 +478,7 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
|
2015-10-02 16:20:59 +02:00
|
|
|
|
|
|
|
if (tb[NFTA_SET_TABLE]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_TABLE))
|
|
|
|
- xfree(s->table);
|
|
|
|
+ nftnl_xfree(s->table);
|
2015-10-02 16:20:59 +02:00
|
|
|
s->table = strdup(mnl_attr_get_str(tb[NFTA_SET_TABLE]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!s->table)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -486,7 +486,7 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
|
2015-10-02 16:20:59 +02:00
|
|
|
}
|
|
|
|
if (tb[NFTA_SET_NAME]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_NAME))
|
|
|
|
- xfree(s->name);
|
|
|
|
+ nftnl_xfree(s->name);
|
2015-10-02 16:20:59 +02:00
|
|
|
s->name = strdup(mnl_attr_get_str(tb[NFTA_SET_NAME]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!s->name)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -982,7 +982,7 @@ void nftnl_set_list_free(struct nftnl_set_list *list)
|
2014-08-16 15:35:48 +02:00
|
|
|
list_del(&s->head);
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_set_free(s);
|
2014-08-16 15:35:48 +02:00
|
|
|
}
|
|
|
|
- xfree(list);
|
|
|
|
+ nftnl_xfree(list);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_set_list_is_empty);
|
|
|
|
@@ -1074,7 +1074,7 @@ struct nftnl_set *nftnl_set_list_iter_next(struct nftnl_set_list_iter *iter)
|
|
|
|
EXPORT_SYMBOL(nftnl_set_list_iter_destroy);
|
2016-06-04 03:11:30 +02:00
|
|
|
void nftnl_set_list_iter_destroy(const struct nftnl_set_list_iter *iter)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
|
|
|
- xfree(iter);
|
|
|
|
+ nftnl_xfree(iter);
|
|
|
|
}
|
2014-12-16 12:42:57 +01:00
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
static struct nftnl_set *nftnl_set_lookup(const char *this_set_name,
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/set_elem.c b/src/set_elem.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index e02a38791c9a..100ccda699c6 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/set_elem.c
|
|
|
|
+++ b/src/set_elem.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -43,18 +43,18 @@ EXPORT_SYMBOL(nftnl_set_elem_free);
|
2016-12-21 15:47:10 +01:00
|
|
|
void nftnl_set_elem_free(struct nftnl_set_elem *s)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN))
|
|
|
|
- xfree(s->data.chain);
|
|
|
|
+ nftnl_xfree(s->data.chain);
|
|
|
|
|
|
|
|
if (s->flags & (1 << NFTNL_SET_ELEM_EXPR))
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_expr_free(s->expr);
|
|
|
|
|
2016-06-04 03:11:30 +02:00
|
|
|
if (s->flags & (1 << NFTNL_SET_ELEM_USERDATA))
|
|
|
|
- xfree(s->user.data);
|
|
|
|
+ nftnl_xfree(s->user.data);
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_ELEM_OBJREF))
|
|
|
|
- xfree(s->objref);
|
|
|
|
+ nftnl_xfree(s->objref);
|
|
|
|
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(s);
|
|
|
|
+ nftnl_xfree(s);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_set_elem_is_set);
|
|
|
|
@@ -71,7 +71,7 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
|
|
|
|
switch (attr) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_SET_ELEM_CHAIN:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(s->data.chain);
|
|
|
|
+ nftnl_xfree(s->data.chain);
|
|
|
|
break;
|
|
|
|
case NFTNL_SET_ELEM_FLAGS:
|
|
|
|
case NFTNL_SET_ELEM_KEY: /* NFTA_SET_ELEM_KEY */
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -81,13 +81,13 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_SET_ELEM_EXPIRATION: /* NFTA_SET_ELEM_EXPIRATION */
|
|
|
|
break;
|
|
|
|
case NFTNL_SET_ELEM_USERDATA: /* NFTA_SET_ELEM_USERDATA */
|
|
|
|
- xfree(s->user.data);
|
|
|
|
+ nftnl_xfree(s->user.data);
|
|
|
|
break;
|
|
|
|
case NFTNL_SET_ELEM_EXPR:
|
|
|
|
nftnl_expr_free(s->expr);
|
|
|
|
break;
|
|
|
|
case NFTNL_SET_ELEM_OBJREF:
|
|
|
|
- xfree(s->objref);
|
|
|
|
+ nftnl_xfree(s->objref);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -113,7 +113,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_SET_ELEM_CHAIN: /* NFTA_SET_ELEM_DATA */
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(s->data.chain);
|
|
|
|
+ nftnl_xfree(s->data.chain);
|
|
|
|
|
|
|
|
s->data.chain = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!s->data.chain)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -128,7 +128,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
|
2016-06-04 03:11:30 +02:00
|
|
|
break;
|
|
|
|
case NFTNL_SET_ELEM_USERDATA: /* NFTA_SET_ELEM_USERDATA */
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_ELEM_USERDATA))
|
2016-06-04 03:11:30 +02:00
|
|
|
- xfree(s->user.data);
|
|
|
|
+ nftnl_xfree(s->user.data);
|
|
|
|
|
|
|
|
s->user.data = malloc(data_len);
|
|
|
|
if (!s->user.data)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -138,7 +138,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
|
2016-12-21 15:47:10 +01:00
|
|
|
break;
|
|
|
|
case NFTNL_SET_ELEM_OBJREF:
|
|
|
|
if (s->flags & (1 << NFTNL_SET_ELEM_OBJREF))
|
|
|
|
- xfree(s->objref);
|
|
|
|
+ nftnl_xfree(s->objref);
|
|
|
|
|
|
|
|
s->objref = strdup(data);
|
|
|
|
if (!s->objref)
|
|
|
|
@@ -431,7 +431,7 @@ static int nftnl_set_elems_parse2(struct nftnl_set *s, const struct nlattr *nest
|
2015-10-02 16:20:59 +02:00
|
|
|
mnl_attr_get_payload(tb[NFTA_SET_ELEM_USERDATA]);
|
|
|
|
|
2016-12-21 15:47:10 +01:00
|
|
|
if (e->flags & (1 << NFTNL_RULE_USERDATA))
|
2015-10-02 16:20:59 +02:00
|
|
|
- xfree(e->user.data);
|
|
|
|
+ nftnl_xfree(e->user.data);
|
2014-08-16 15:35:48 +02:00
|
|
|
|
2015-10-02 16:20:59 +02:00
|
|
|
e->user.len = mnl_attr_get_payload_len(tb[NFTA_SET_ELEM_USERDATA]);
|
|
|
|
e->user.data = malloc(e->user.len);
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -516,7 +516,7 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
|
2015-10-02 16:20:59 +02:00
|
|
|
|
|
|
|
if (tb[NFTA_SET_ELEM_LIST_TABLE]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_TABLE))
|
|
|
|
- xfree(s->table);
|
|
|
|
+ nftnl_xfree(s->table);
|
2015-10-02 16:20:59 +02:00
|
|
|
s->table =
|
|
|
|
strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_TABLE]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!s->table)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -525,7 +525,7 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
|
2015-10-02 16:20:59 +02:00
|
|
|
}
|
|
|
|
if (tb[NFTA_SET_ELEM_LIST_SET]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (s->flags & (1 << NFTNL_SET_NAME))
|
|
|
|
- xfree(s->name);
|
|
|
|
+ nftnl_xfree(s->name);
|
2015-10-02 16:20:59 +02:00
|
|
|
s->name =
|
|
|
|
strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_SET]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!s->name)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -816,7 +816,7 @@ struct nftnl_set_elem *nftnl_set_elems_iter_next(struct nftnl_set_elems_iter *it
|
|
|
|
EXPORT_SYMBOL(nftnl_set_elems_iter_destroy);
|
2015-10-02 16:20:59 +02:00
|
|
|
void nftnl_set_elems_iter_destroy(struct nftnl_set_elems_iter *iter)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
|
|
|
- xfree(iter);
|
|
|
|
+ nftnl_xfree(iter);
|
|
|
|
}
|
2014-12-16 12:42:57 +01:00
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
static bool nftnl_attr_nest_overflow(struct nlmsghdr *nlh,
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/table.c b/src/table.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 7f97ca4e5807..7ac57c33021b 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/table.c
|
|
|
|
+++ b/src/table.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -46,9 +46,9 @@ EXPORT_SYMBOL(nftnl_table_free);
|
2016-06-04 03:11:30 +02:00
|
|
|
void nftnl_table_free(const struct nftnl_table *t)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
2015-10-02 16:20:59 +02:00
|
|
|
if (t->flags & (1 << NFTNL_TABLE_NAME))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(t->name);
|
|
|
|
+ nftnl_xfree(t->name);
|
|
|
|
|
|
|
|
- xfree(t);
|
|
|
|
+ nftnl_xfree(t);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_table_is_set);
|
|
|
|
@@ -65,7 +65,7 @@ void nftnl_table_unset(struct nftnl_table *t, uint16_t attr)
|
2016-12-21 15:47:10 +01:00
|
|
|
|
2014-08-16 15:35:48 +02:00
|
|
|
switch (attr) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_TABLE_NAME:
|
2016-12-21 15:47:10 +01:00
|
|
|
- xfree(t->name);
|
|
|
|
+ nftnl_xfree(t->name);
|
2014-08-16 15:35:48 +02:00
|
|
|
break;
|
2016-12-21 15:47:10 +01:00
|
|
|
case NFTNL_TABLE_FLAGS:
|
|
|
|
case NFTNL_TABLE_FAMILY:
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -91,7 +91,7 @@ int nftnl_table_set_data(struct nftnl_table *t, uint16_t attr,
|
2014-08-16 15:35:48 +02:00
|
|
|
switch (attr) {
|
2015-10-02 16:20:59 +02:00
|
|
|
case NFTNL_TABLE_NAME:
|
2016-12-21 15:47:10 +01:00
|
|
|
if (t->flags & (1 << NFTNL_TABLE_NAME))
|
2014-08-16 15:35:48 +02:00
|
|
|
- xfree(t->name);
|
|
|
|
+ nftnl_xfree(t->name);
|
|
|
|
|
|
|
|
t->name = strdup(data);
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!t->name)
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -230,7 +230,7 @@ int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t)
|
2015-10-02 16:20:59 +02:00
|
|
|
|
|
|
|
if (tb[NFTA_TABLE_NAME]) {
|
2016-12-21 15:47:10 +01:00
|
|
|
if (t->flags & (1 << NFTNL_TABLE_NAME))
|
|
|
|
- xfree(t->name);
|
|
|
|
+ nftnl_xfree(t->name);
|
2015-10-02 16:20:59 +02:00
|
|
|
t->name = strdup(mnl_attr_get_str(tb[NFTA_TABLE_NAME]));
|
2016-12-21 15:47:10 +01:00
|
|
|
if (!t->name)
|
|
|
|
return -1;
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -452,7 +452,7 @@ void nftnl_table_list_free(struct nftnl_table_list *list)
|
2014-08-16 15:35:48 +02:00
|
|
|
list_del(&r->head);
|
2015-10-02 16:20:59 +02:00
|
|
|
nftnl_table_free(r);
|
2014-08-16 15:35:48 +02:00
|
|
|
}
|
|
|
|
- xfree(list);
|
|
|
|
+ nftnl_xfree(list);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_table_list_is_empty);
|
|
|
|
@@ -538,5 +538,5 @@ struct nftnl_table *nftnl_table_list_iter_next(struct nftnl_table_list_iter *ite
|
|
|
|
EXPORT_SYMBOL(nftnl_table_list_iter_destroy);
|
2016-06-04 03:11:30 +02:00
|
|
|
void nftnl_table_list_iter_destroy(const struct nftnl_table_list_iter *iter)
|
2014-08-16 15:35:48 +02:00
|
|
|
{
|
|
|
|
- xfree(iter);
|
|
|
|
+ nftnl_xfree(iter);
|
|
|
|
}
|
2016-06-04 03:11:30 +02:00
|
|
|
diff --git a/src/trace.c b/src/trace.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index f4264377508e..8a18391d83d1 100644
|
2016-06-04 03:11:30 +02:00
|
|
|
--- a/src/trace.c
|
|
|
|
+++ b/src/trace.c
|
|
|
|
@@ -61,13 +61,13 @@ struct nftnl_trace *nftnl_trace_alloc(void)
|
|
|
|
EXPORT_SYMBOL(nftnl_trace_free);
|
|
|
|
void nftnl_trace_free(const struct nftnl_trace *t)
|
|
|
|
{
|
|
|
|
- xfree(t->chain);
|
|
|
|
- xfree(t->table);
|
|
|
|
- xfree(t->jump_target);
|
|
|
|
- xfree(t->ll.data);
|
|
|
|
- xfree(t->nh.data);
|
|
|
|
- xfree(t->th.data);
|
|
|
|
- xfree(t);
|
|
|
|
+ nftnl_xfree(t->chain);
|
|
|
|
+ nftnl_xfree(t->table);
|
|
|
|
+ nftnl_xfree(t->jump_target);
|
|
|
|
+ nftnl_xfree(t->ll.data);
|
|
|
|
+ nftnl_xfree(t->nh.data);
|
|
|
|
+ nftnl_xfree(t->th.data);
|
|
|
|
+ nftnl_xfree(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPORT_SYMBOL(nftnl_trace_is_set);
|
|
|
|
diff --git a/src/udata.c b/src/udata.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 6bd965161c43..049819304ef5 100644
|
2016-06-04 03:11:30 +02:00
|
|
|
--- a/src/udata.c
|
|
|
|
+++ b/src/udata.c
|
2018-01-28 20:42:46 +01:00
|
|
|
@@ -33,7 +33,7 @@ struct nftnl_udata_buf *nftnl_udata_buf_alloc(uint32_t data_size)
|
|
|
|
EXPORT_SYMBOL(nftnl_udata_buf_free);
|
2016-06-04 03:11:30 +02:00
|
|
|
void nftnl_udata_buf_free(const struct nftnl_udata_buf *buf)
|
|
|
|
{
|
|
|
|
- xfree(buf);
|
|
|
|
+ nftnl_xfree(buf);
|
|
|
|
}
|
|
|
|
|
2018-01-28 20:42:46 +01:00
|
|
|
EXPORT_SYMBOL(nftnl_udata_buf_len);
|
2014-12-29 15:38:14 +01:00
|
|
|
diff --git a/src/utils.c b/src/utils.c
|
2018-01-28 20:42:46 +01:00
|
|
|
index 3e449609395e..08f668f56a95 100644
|
2014-12-29 15:38:14 +01:00
|
|
|
--- a/src/utils.c
|
|
|
|
+++ b/src/utils.c
|
2016-06-04 03:11:30 +02:00
|
|
|
@@ -264,7 +264,7 @@ int nftnl_fprintf(FILE *fp, const void *obj, uint32_t cmd, uint32_t type,
|
2014-08-16 15:35:48 +02:00
|
|
|
|
|
|
|
out:
|
|
|
|
if (buf != _buf)
|
|
|
|
- xfree(buf);
|
|
|
|
+ nftnl_xfree(buf);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2014-12-29 15:38:14 +01:00
|
|
|
--
|
2018-01-28 20:42:46 +01:00
|
|
|
2.15.1
|
2014-12-29 15:38:14 +01:00
|
|
|
|