[Devel] Re: [PATCH 1/2] nfnetlink: add netns support
Patrick McHardy
kaber at trash.net
Wed Jan 13 05:02:33 PST 2010
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.
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list