From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH iptables] libxt_cgroup2: add support for cgroup2 path matching Date: Tue, 17 Nov 2015 18:09:24 -0500 Message-ID: <20151117230924.GL22864@mtj.duckdns.org> References: <1447789240-29394-1-git-send-email-tj@kernel.org> <20151117194221.GB22864@mtj.duckdns.org> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=2cnBqyC+G8zavOflyHQ0X5qBZx6MEmXBftnw0oJX+oY=; b=z7rgM4DDnmTY0qA6yi6Yumlc3iAIf6aVRoPca3/Iqhd+0Uk6HaCb0u3VetYQaJSzey 8S5RlVI4Aa/NyQXdWuYiiwrdsy84NMQNWYgoJsu++wpvBxZj9/rwlka1CoYwwJ5+Yssi iXL52qZo1d/esZ8aDtUr8eM0H/swGPWsEtLIAYr1zr1TmhQAnYiLm7HNJl5ADHNHjo/6 fI6mV3RATITrWQkSgYCSm/qsNgxmAlPVBCz0kzpyb/HSgJ8hdIddZOhye9AnTPKUVyrR Ux1JVZuC/istMx8fjRXwW7a8KFrpo+nIb6F5wH6OjkvhWUzL2UoAqSlWKtt2b6uGETKa XoHg== Content-Disposition: inline In-Reply-To: Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jan Engelhardt Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org, pablo-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org, kaber-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org, kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO@public.gmane.org, lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, coreteam-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-team-b10kYP2dOMg@public.gmane.org, daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org, daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org, nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org Hello, On Wed, Nov 18, 2015 at 12:02:01AM +0100, Jan Engelhardt wrote: > On Tuesday 2015-11-17 20:42, Tejun Heo wrote: > >+static void cgroup2_save(const void *ip, const struct xt_entry_match *match) > >+{ > >+ const struct xt_cgroup2_info *info = (void *)match->data; > >+ > >+ printf("%s --path %s", info->invert ? " !" : "", info->path); > >+} > > Can cgroup path names contain anything fancy, like spaces, backslashes, etc.? > If so, xtables_save_string() will be needed here. Will update. > >+static struct xtables_match cgroup2_match = { > >+ .family = NFPROTO_UNSPEC, > >+ .name = "cgroup2", > >+ .version = XTABLES_VERSION, > >+ .size = XT_ALIGN(sizeof(struct xt_cgroup2_info)), > >+ .userspacesize = XT_ALIGN(sizeof(struct xt_cgroup2_info)), > > userspacesize must not include xt_cgroup2_info.priv. > Change to offsetof(...), cf. other .c modules which do this. Ah, okay. ... > >+\fBIMPORTANT\fP: when being used in the INPUT chain, the cgroup2 > >+matcher is currently only of limited functionality, meaning it > >+will only match on packets that are processed for local sockets > >+through early socket demuxing. Therefore, general usage on the > >+INPUT chain is disadviced unless the implications are well > > is disadviced (sic) -> is not advised Will update. That's copied verbatim from xt_cgroup tho. Will create a patch to update that too. Thanks. -- tejun From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755016AbbKQXJa (ORCPT ); Tue, 17 Nov 2015 18:09:30 -0500 Received: from mail-yk0-f169.google.com ([209.85.160.169]:35872 "EHLO mail-yk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbbKQXJ2 (ORCPT ); Tue, 17 Nov 2015 18:09:28 -0500 Date: Tue, 17 Nov 2015 18:09:24 -0500 From: Tejun Heo To: Jan Engelhardt Cc: davem@davemloft.net, pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu, lizefan@huawei.com, hannes@cmpxchg.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, daniel@iogearbox.net, daniel.wagner@bmw-carit.de, nhorman@tuxdriver.com Subject: Re: [PATCH iptables] libxt_cgroup2: add support for cgroup2 path matching Message-ID: <20151117230924.GL22864@mtj.duckdns.org> References: <1447789240-29394-1-git-send-email-tj@kernel.org> <20151117194221.GB22864@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Wed, Nov 18, 2015 at 12:02:01AM +0100, Jan Engelhardt wrote: > On Tuesday 2015-11-17 20:42, Tejun Heo wrote: > >+static void cgroup2_save(const void *ip, const struct xt_entry_match *match) > >+{ > >+ const struct xt_cgroup2_info *info = (void *)match->data; > >+ > >+ printf("%s --path %s", info->invert ? " !" : "", info->path); > >+} > > Can cgroup path names contain anything fancy, like spaces, backslashes, etc.? > If so, xtables_save_string() will be needed here. Will update. > >+static struct xtables_match cgroup2_match = { > >+ .family = NFPROTO_UNSPEC, > >+ .name = "cgroup2", > >+ .version = XTABLES_VERSION, > >+ .size = XT_ALIGN(sizeof(struct xt_cgroup2_info)), > >+ .userspacesize = XT_ALIGN(sizeof(struct xt_cgroup2_info)), > > userspacesize must not include xt_cgroup2_info.priv. > Change to offsetof(...), cf. other .c modules which do this. Ah, okay. ... > >+\fBIMPORTANT\fP: when being used in the INPUT chain, the cgroup2 > >+matcher is currently only of limited functionality, meaning it > >+will only match on packets that are processed for local sockets > >+through early socket demuxing. Therefore, general usage on the > >+INPUT chain is disadviced unless the implications are well > > is disadviced (sic) -> is not advised Will update. That's copied verbatim from xt_cgroup tho. Will create a patch to update that too. Thanks. -- tejun