Add translation for the network classifier cgroup to nftables. Examples: $ sudo iptables-translate -A input -m cgroup --cgroup 0x100001 -j DROP nft add rule ip filter input meta cgroup 1048577 counter drop $ sudo iptables-translate -A input -m cgroup ! --cgroup 0x100001 -j DROP nft add rule ip filter input meta cgroup != 1048577 counter drop Signed-off-by: Shivani Bhardwaj <shivanib134@xxxxxxxxx> --- extensions/libxt_cgroup.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/extensions/libxt_cgroup.c b/extensions/libxt_cgroup.c index e304e33..dea1417 100644 --- a/extensions/libxt_cgroup.c +++ b/extensions/libxt_cgroup.c @@ -48,6 +48,17 @@ static void cgroup_save(const void *ip, const struct xt_entry_match *match) printf("%s --cgroup %u", info->invert ? " !" : "", info->id); } +static int cgroup_xlate(const struct xt_entry_match *match, + struct xt_buf *buf, int numeric) +{ + const struct xt_cgroup_info *info = (void *) match->data; + + xt_buf_add(buf, "meta cgroup%s %u ", + info->invert ? " !=" : "", info->id); + + return 1; +} + static struct xtables_match cgroup_match = { .family = NFPROTO_UNSPEC, .name = "cgroup", @@ -59,6 +70,7 @@ static struct xtables_match cgroup_match = { .save = cgroup_save, .x6_parse = cgroup_parse, .x6_options = cgroup_opts, + .xlate = cgroup_xlate, }; void _init(void) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html