[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49BE71AF.8050200@trash.net>
Date: Mon, 16 Mar 2009 16:35:11 +0100
From: Patrick McHardy <kaber@...sh.net>
To: Cyrill Gorcunov <gorcunov@...il.com>
CC: davem@...emloft.net, daniel.lezcano@...e.fr,
netdev@...r.kernel.org, netfilter-devel@...r.kernel.org,
xemul@...nvz.org, adobriyan@...il.com,
Cyrill Gorcunov <gorcunov@...nvz.org>
Subject: Re: [RFC v2 3/7] net: netfilter conntrack - add per-net functionality
for SCTP protocol
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?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists