All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: davem@davemloft.net, daniel.lezcano@free.fr,
	netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
	xemul@openvz.org, adobriyan@gmail.com,
	Cyrill Gorcunov <gorcunov@openvz.org>
Subject: Re: [RFC v2 3/7] net: netfilter conntrack - add per-net functionality for SCTP protocol
Date: Mon, 16 Mar 2009 16:35:11 +0100	[thread overview]
Message-ID: <49BE71AF.8050200@trash.net> (raw)
In-Reply-To: <20090311210817.384140456@gmail.com>

Cyrill Gorcunov wrote:
> Module specific data moved into per-net site and being allocated/freed
> during net namespace creation/deletion.

> +#define ___PERNET_TO_DAT(i, j) \
> +	sn->sysctl_table[i].data = &sn->sctp_timeouts[j]
> +
> +	___PERNET_TO_DAT(0, SCTP_CONNTRACK_CLOSED);
> +	___PERNET_TO_DAT(1, SCTP_CONNTRACK_COOKIE_WAIT);
> +	___PERNET_TO_DAT(2, SCTP_CONNTRACK_COOKIE_ECHOED);
> +	___PERNET_TO_DAT(3, SCTP_CONNTRACK_ESTABLISHED);
> +	___PERNET_TO_DAT(4, SCTP_CONNTRACK_SHUTDOWN_SENT);
> +	___PERNET_TO_DAT(5, SCTP_CONNTRACK_SHUTDOWN_RECD);
> +	___PERNET_TO_DAT(6, SCTP_CONNTRACK_SHUTDOWN_ACK_SENT);
> +
> +#undef ___PERNET_TO_DAT
> +
> +	sn->sysctl_header = register_net_sysctl_table(net,
> +			nf_net_netfilter_sysctl_path, sn->sysctl_table);
> +	if (!sn->sysctl_header)
> +		goto out_free;
> +
> +#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
> +	sn->compat_sysctl_table = kmemdup(sctp_compat_sysctl_table,
> +			sizeof(sctp_compat_sysctl_table), GFP_KERNEL);
> +	if (!sn->compat_sysctl_table)
> +		goto out_sysctl;
> +
> +#define ___PERNET_TO_DAT(i, j) \
> +	sn->compat_sysctl_table[i].data = &sn->sctp_timeouts[j]
> +
> +	___PERNET_TO_DAT(0, SCTP_CONNTRACK_CLOSED);
> +	___PERNET_TO_DAT(1, SCTP_CONNTRACK_COOKIE_WAIT);
> +	___PERNET_TO_DAT(2, SCTP_CONNTRACK_COOKIE_ECHOED);
> +	___PERNET_TO_DAT(3, SCTP_CONNTRACK_ESTABLISHED);
> +	___PERNET_TO_DAT(4, SCTP_CONNTRACK_SHUTDOWN_SENT);
> +	___PERNET_TO_DAT(5, SCTP_CONNTRACK_SHUTDOWN_RECD);
> +	___PERNET_TO_DAT(6, SCTP_CONNTRACK_SHUTDOWN_ACK_SENT);
> +
> +#undef ___PERNET_TO_DAT

This is really ugly and is somewhat risky since those magic offsets need
to be kept in sync. Any chance (I don't have a suggestion currently) to
do this in a nicer way?

  parent reply	other threads:[~2009-03-16 15:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 20:57 [RFC v2 0/7] introduce netfilter conntrack protos pernet functionality v2 Cyrill Gorcunov
2009-03-11 20:57 ` [RFC v2 1/7] net: sysctl_net - use net_eq to compare nets Cyrill Gorcunov
2009-03-12  8:50   ` Daniel Lezcano
2009-03-16 15:24     ` Patrick McHardy
2009-03-11 20:57 ` [RFC v2 2/7] net: netfilter conntrack - add per-net functionality for DCCP protocol Cyrill Gorcunov
2009-03-12  8:54   ` Daniel Lezcano
2009-03-16 15:31     ` Patrick McHardy
2009-03-11 20:57 ` [RFC v2 3/7] net: netfilter conntrack - add per-net functionality for SCTP protocol Cyrill Gorcunov
2009-03-12  9:03   ` Daniel Lezcano
2009-03-16 15:35   ` Patrick McHardy [this message]
2009-03-16 15:46     ` Cyrill Gorcunov
2009-03-16 15:48       ` Patrick McHardy
2009-03-16 18:21         ` Cyrill Gorcunov
2009-03-16 18:29           ` Patrick McHardy
2009-03-16 18:45             ` Cyrill Gorcunov
2009-03-16 21:03             ` Cyrill Gorcunov
2009-03-11 20:57 ` [RFC v2 4/7] net: netfilter conntrack - add per-net functionality for UDPLITE protocol Cyrill Gorcunov
2009-03-12  9:07   ` Daniel Lezcano
2009-03-11 20:57 ` [RFC v2 5/7] net: netfilter conntrack - add per-net functionality for TCP protocol Cyrill Gorcunov
2009-03-12  9:15   ` Daniel Lezcano
2009-03-16 20:58   ` Cyrill Gorcunov
2009-03-26 15:13     ` Patrick McHardy
2009-03-26 15:37       ` Cyrill Gorcunov
2009-03-26 15:46         ` Patrick McHardy
2009-03-26 15:51           ` Cyrill Gorcunov
2009-03-11 20:57 ` [RFC v2 6/7] net: netfilter conntrack - add per-net functionality for UDP protocol Cyrill Gorcunov
2009-03-12  9:49   ` Daniel Lezcano
2009-03-11 20:57 ` [RFC v2 7/7] net: netfilter conntrack - add per-net functionality for ICMP protocol Cyrill Gorcunov
2009-03-12  9:51   ` Daniel Lezcano

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=49BE71AF.8050200@trash.net \
    --to=kaber@trash.net \
    --cc=adobriyan@gmail.com \
    --cc=daniel.lezcano@free.fr \
    --cc=davem@davemloft.net \
    --cc=gorcunov@gmail.com \
    --cc=gorcunov@openvz.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=xemul@openvz.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.