summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-10-09 20:36:36 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-09 20:36:36 +0200
commit8ca343624da596313f566147f54d206a24994aae (patch)
tree9bf1a7b9c84915e6c6feec344f095abe8a65760f
parent0a8f2bcadff157489a737f8cc8846adcb750b91f (diff)
extensions: cgroup: fix option parsing for v2
Structure layout is different, therefore a new struct xt_option_entry is needed. Fixes: f9efc8cb79c0 ("extensions: add cgroup revision 2") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--extensions/libxt_cgroup.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/extensions/libxt_cgroup.c b/extensions/libxt_cgroup.c
index d4a29092..327032ea 100644
--- a/extensions/libxt_cgroup.c
+++ b/extensions/libxt_cgroup.c
@@ -51,6 +51,24 @@ static const struct xt_option_entry cgroup_opts_v1[] = {
XTOPT_TABLEEND,
};
+static const struct xt_option_entry cgroup_opts_v2[] = {
+ {
+ .name = "path",
+ .id = O_PATH,
+ .type = XTTYPE_STRING,
+ .flags = XTOPT_INVERT | XTOPT_PUT,
+ XTOPT_POINTER(struct xt_cgroup_info_v2, path)
+ },
+ {
+ .name = "cgroup",
+ .id = O_CLASSID,
+ .type = XTTYPE_UINT32,
+ .flags = XTOPT_INVERT | XTOPT_PUT,
+ XTOPT_POINTER(struct xt_cgroup_info_v2, classid)
+ },
+ XTOPT_TABLEEND,
+};
+
static void cgroup_parse_v0(struct xt_option_call *cb)
{
struct xt_cgroup_info_v0 *cgroupinfo = cb->data;
@@ -249,7 +267,7 @@ static struct xtables_match cgroup_match[] = {
.print = cgroup_print_v2,
.save = cgroup_save_v2,
.x6_parse = cgroup_parse_v2,
- .x6_options = cgroup_opts_v1,
+ .x6_options = cgroup_opts_v2,
.xlate = cgroup_xlate_v2,
},
};