From 80077787f8f21da1efd8dc27a4c5767ab47a1df6 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 9 Oct 2018 00:03:28 +0200 Subject: src: remove json support We have better json support in libnftables these days. Signed-off-by: Pablo Neira Ayuso --- src/expr/masq.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) (limited to 'src/expr/masq.c') diff --git a/src/expr/masq.c b/src/expr/masq.c index 7c235d3..78dd76b 100644 --- a/src/expr/masq.c +++ b/src/expr/masq.c @@ -131,46 +131,6 @@ nftnl_expr_masq_parse(struct nftnl_expr *e, struct nlattr *attr) return 0; } -static int -nftnl_expr_masq_json_parse(struct nftnl_expr *e, json_t *root, - struct nftnl_parse_err *err) -{ -#ifdef JSON_PARSING - uint32_t reg, flags; - - if (nftnl_jansson_parse_val(root, "flags", NFTNL_TYPE_U32, &flags, - err) == 0) - nftnl_expr_set_u32(e, NFTNL_EXPR_MASQ_FLAGS, flags); - if (nftnl_jansson_parse_reg(root, "sreg_proto_min", NFTNL_TYPE_U32, - ®, err) == 0) - nftnl_expr_set_u32(e, NFTNL_EXPR_MASQ_REG_PROTO_MIN, reg); - if (nftnl_jansson_parse_reg(root, "sreg_proto_max", NFTNL_TYPE_U32, - ®, err) == 0) - nftnl_expr_set_u32(e, NFTNL_EXPR_MASQ_REG_PROTO_MAX, reg); - - return 0; -#else - errno = EOPNOTSUPP; - return -1; -#endif -} - -static int nftnl_expr_masq_export(char *buf, size_t size, - const struct nftnl_expr *e, int type) -{ - struct nftnl_expr_masq *masq = nftnl_expr_data(e); - NFTNL_BUF_INIT(b, buf, size); - - if (e->flags & (1 << NFTNL_EXPR_MASQ_FLAGS)) - nftnl_buf_u32(&b, type, masq->flags, FLAGS); - if (e->flags & (1 << NFTNL_EXPR_MASQ_REG_PROTO_MIN)) - nftnl_buf_u32(&b, type, masq->sreg_proto_min, SREG_PROTO_MIN); - if (e->flags & (1 << NFTNL_EXPR_MASQ_REG_PROTO_MAX)) - nftnl_buf_u32(&b, type, masq->sreg_proto_max, SREG_PROTO_MAX); - - return nftnl_buf_done(&b); -} - static int nftnl_expr_masq_snprintf_default(char *buf, size_t len, const struct nftnl_expr *e) { @@ -195,7 +155,6 @@ static int nftnl_expr_masq_snprintf(char *buf, size_t len, uint32_t type, return nftnl_expr_masq_snprintf_default(buf, len, e); case NFTNL_OUTPUT_XML: case NFTNL_OUTPUT_JSON: - return nftnl_expr_masq_export(buf, len, e, type); default: break; } @@ -229,5 +188,4 @@ struct expr_ops expr_ops_masq = { .parse = nftnl_expr_masq_parse, .build = nftnl_expr_masq_build, .snprintf = nftnl_expr_masq_snprintf, - .json_parse = nftnl_expr_masq_json_parse, }; -- cgit v1.2.3