From: Vijay Subramanian <subramanian.vijay@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org, kaber@trash.net,
Vijay Subramanian <subramanian.vijay@gmail.com>
Subject: [PATCH libnftnl] Fix compilation with JSON and XML parsing enabled
Date: Fri, 9 Oct 2015 12:21:07 -0700 [thread overview]
Message-ID: <1444418467-18610-1-git-send-email-subramanian.vijay@gmail.com> (raw)
Fix missing/incorrect variables.
Also remove unsed variables to avoid warnings.
Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
---
src/expr/dup.c | 13 +++++--------
src/expr/limit.c | 2 +-
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/expr/dup.c b/src/expr/dup.c
index d0fa35f..217450a 100644
--- a/src/expr/dup.c
+++ b/src/expr/dup.c
@@ -115,18 +115,16 @@ static int nftnl_expr_dup_json_parse(struct nftnl_expr *e, json_t *root,
struct nftnl_parse_err *err)
{
#ifdef JSON_PARSING
- struct nftnl_expr_dup *dup = nftnl_expr_data(e);
uint32_t sreg_addr, sreg_dev;
- int datareg_type;
+ int ret = 0;
- ret = nftnl_jansson_parse_val(root, "sreg_addr", NFT_TYPE_U32, &sreg_addr, err);
+ ret = nftnl_jansson_parse_val(root, "sreg_addr", NFTNL_TYPE_U32, &sreg_addr, err);
if (ret >= 0)
nftnl_expr_set_u32(e, NFTNL_EXPR_DUP_SREG_DEV, sreg_addr);
- ret = nftnl_jansson_parse_val(root, "sreg_dev", NFT_TYPE_U32, &sreg_dev, err);
+ ret = nftnl_jansson_parse_val(root, "sreg_dev", NFTNL_TYPE_U32, &sreg_dev, err);
if (ret >= 0)
nftnl_expr_set_u32(e, NFTNL_EXPR_DUP_SREG_DEV, sreg_dev);
-
return 0;
#else
errno = EOPNOTSUPP;
@@ -138,14 +136,13 @@ static int nftnl_expr_dup_xml_parse(struct nftnl_expr *e, mxml_node_t *tree,
struct nftnl_parse_err *err)
{
#ifdef XML_PARSING
- struct nftnl_expr_dup *dup = nftnl_expr_data(e);
uint32_t sreg_addr, sreg_dev;
if (nftnl_mxml_reg_parse(tree, "sreg_addr", &sreg_addr, MXML_DESCEND_FIRST,
- NFT_XML_OPT, err) == 0)
+ NFTNL_XML_OPT, err) == 0)
nftnl_expr_set_u32(e, NFTNL_EXPR_DUP_SREG_ADDR, sreg_addr);
if (nftnl_mxml_reg_parse(tree, "sreg_dev", &sreg_dev, MXML_DESCEND_FIRST,
- NFT_XML_OPT, err) == 0)
+ NFTNL_XML_OPT, err) == 0)
nftnl_expr_set_u32(e, NFTNL_EXPR_DUP_SREG_DEV, sreg_dev);
return 0;
diff --git a/src/expr/limit.c b/src/expr/limit.c
index ef7c17f..ab9ceff 100644
--- a/src/expr/limit.c
+++ b/src/expr/limit.c
@@ -189,7 +189,7 @@ static int nftnl_expr_limit_xml_parse(struct nftnl_expr *e,
&burst, NFTNL_TYPE_U32, NFTNL_XML_MAND, err) == 0)
nftnl_expr_set_u32(e, NFTNL_EXPR_LIMIT_BURST, burst);
if (nftnl_mxml_num_parse(tree, "type", MXML_DESCEND_FIRST, BASE_DEC,
- &burst, NFT_TYPE_U32, NFTNL_XML_MAND, err) == 0)
+ &type, NFTNL_TYPE_U32, NFTNL_XML_MAND, err) == 0)
nftnl_expr_set_u32(e, NFTNL_EXPR_LIMIT_TYPE, type);
return 0;
--
1.7.9.5
next reply other threads:[~2015-10-09 19:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 19:21 Vijay Subramanian [this message]
2015-10-09 20:08 ` [PATCH libnftnl] Fix compilation with JSON and XML parsing enabled Aaron Conole
2015-10-09 20:11 ` Aaron Conole
2015-10-09 22:08 ` Vijay Subramanian
2015-10-12 16:14 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444418467-18610-1-git-send-email-subramanian.vijay@gmail.com \
--to=subramanian.vijay@gmail.com \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).