summaryrefslogtreecommitdiffstats
path: root/src/expr/xfrm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr/xfrm.c')
-rw-r--r--src/expr/xfrm.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/expr/xfrm.c b/src/expr/xfrm.c
index b159d60..dd3062c 100644
--- a/src/expr/xfrm.c
+++ b/src/expr/xfrm.c
@@ -199,66 +199,6 @@ static int str2xfmrdir(const char *s)
}
#endif
-static int nftnl_expr_xfrm_json_parse(struct nftnl_expr *e, json_t *root,
- struct nftnl_parse_err *err)
-{
-#ifdef JSON_PARSING
- const char *key_str, *dir_str;
- uint32_t reg, key, spnum;
- uint8_t dir;
-
- if (nftnl_jansson_parse_reg(root, "dreg", NFTNL_TYPE_U32, &reg, err) == 0)
- nftnl_expr_set_u32(e, NFTNL_EXPR_XFRM_DREG, reg);
-
- key_str = nftnl_jansson_parse_str(root, "key", err);
- if (key_str != NULL) {
- key = str2xfrmkey(key_str);
- if (key < 0)
- return -1;
-
- nftnl_expr_set_u32(e, NFTNL_EXPR_XFRM_KEY, key);
- }
-
- dir_str = nftnl_jansson_parse_str(root, "dir", err);
- if (dir_str != NULL) {
- dir = str2xfmrdir(dir_str);
- if (dir == -1) {
- err->node_name = "dir";
- err->error = NFTNL_PARSE_EBADTYPE;
- goto err;
- }
- nftnl_expr_set_u8(e, NFTNL_EXPR_XFRM_DIR, dir);
- }
-
- return 0;
-err:
- errno = EINVAL;
- return -1;
-#else
- errno = EOPNOTSUPP;
- return -1;
-#endif
-}
-
-static int
-nftnl_expr_xfrm_export(char *buf, size_t size, const struct nftnl_expr *e,
- int type)
-{
- struct nftnl_expr_xfrm *x = nftnl_expr_data(e);
- NFTNL_BUF_INIT(b, buf, size);
-
- if (e->flags & (1 << NFTNL_EXPR_XFRM_DREG))
- nftnl_buf_u32(&b, type, x->dreg, DREG);
- if (e->flags & (1 << NFTNL_EXPR_XFRM_KEY))
- nftnl_buf_str(&b, type, xfrmkey2str(x->key), KEY);
- if (e->flags & (1 << NFTNL_EXPR_XFRM_DIR))
- nftnl_buf_str(&b, type, xfrmdir2str(x->dir), DIR);
- if (e->flags & (1 << NFTNL_EXPR_XFRM_SPNUM))
- nftnl_buf_u32(&b, type, x->spnum, NUM);
-
- return nftnl_buf_done(&b);
-}
-
static int
nftnl_expr_xfrm_snprintf_default(char *buf, size_t size,
const struct nftnl_expr *e)
@@ -285,7 +225,6 @@ nftnl_expr_xfrm_snprintf(char *buf, size_t len, uint32_t type,
return nftnl_expr_xfrm_snprintf_default(buf, len, e);
case NFTNL_OUTPUT_XML:
case NFTNL_OUTPUT_JSON:
- return nftnl_expr_xfrm_export(buf, len, e, type);
default:
break;
}
@@ -321,5 +260,4 @@ struct expr_ops expr_ops_xfrm = {
.parse = nftnl_expr_xfrm_parse,
.build = nftnl_expr_xfrm_build,
.snprintf = nftnl_expr_xfrm_snprintf,
- .json_parse = nftnl_expr_xfrm_json_parse,
};