From: Patrick McHardy <kaber@trash.net>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: netfilter-devel@vger.kernel.org, containers@lists.linux-foundation.org
Subject: Re: [PATCH 1/2] nfnetlink: add netns support
Date: Wed, 13 Jan 2010 14:02:33 +0100 [thread overview]
Message-ID: <4B4DC469.5000408@trash.net> (raw)
In-Reply-To: <20100113122420.GA5790@x200>
Alexey Dobriyan wrote:
> Make nfnetlink socket per-netns.
>
> --- a/include/net/net_namespace.h
> +++ b/include/net/net_namespace.h
> @@ -81,6 +81,8 @@ struct net {
> #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
> struct netns_ct ct;
> #endif
> + struct sock *nfnl;
> + struct sock *nfnl_stash;
Shouldn't this be contained in an ifdef(CONFIG_NETFILTER_NETLINK)
(_MODULE) ?
> #endif
> +static void __net_exit nfnetlink_net_exit_batch(struct list_head *net_exit_list)
> {
> - printk("Netfilter messages via NETLINK v%s.\n", nfversion);
> + struct net *net;
>
> - nfnl = netlink_kernel_create(&init_net, NETLINK_NETFILTER, NFNLGRP_MAX,
> - nfnetlink_rcv, NULL, THIS_MODULE);
> - if (!nfnl) {
> - printk(KERN_ERR "cannot initialize nfnetlink!\n");
> - return -ENOMEM;
> + list_for_each_entry(net, net_exit_list, exit_list) {
> + rcu_assign_pointer(net->nfnl, NULL);
> + }
> + synchronize_net();
> + list_for_each_entry(net, net_exit_list, exit_list) {
> + netlink_kernel_release(net->nfnl_stash);
> }
No parenthesis around single statements please.
> --- a/net/netfilter/nfnetlink_log.c
> +++ b/net/netfilter/nfnetlink_log.c
> @@ -323,7 +323,7 @@ __nfulnl_send(struct nfulnl_instance *inst)
> NLMSG_DONE,
> sizeof(struct nfgenmsg));
>
> - status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT);
> + status = nfnetlink_unicast(inst->skb, &init_net, inst->peer_pid, MSG_DONTWAIT);
Overly long line.
The remaining parts look good to me.
next prev parent reply other threads:[~2010-01-13 13:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-13 12:24 [PATCH 1/2] nfnetlink: add netns support Alexey Dobriyan
2010-01-13 13:02 ` Patrick McHardy [this message]
2010-01-13 13:22 ` Alexey Dobriyan
2010-01-13 13:27 ` Patrick McHardy
2010-01-13 13:37 ` Alexey Dobriyan
2010-01-13 13:42 ` Patrick McHardy
2010-01-13 13:47 ` Alexey Dobriyan
2010-01-13 13:49 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B4DC469.5000408@trash.net \
--to=kaber@trash.net \
--cc=adobriyan@gmail.com \
--cc=containers@lists.linux-foundation.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).