Subject: Re: [RFC v2 3/7] net: netfilter conntrack - add per-net functionality for SCTP protocol

From: Cyrill Gorcunov <[email-masked]>
Date: Mon, 16 Mar 2009 18:46:20 +0300

[Patrick McHardy - Mon, Mar 16, 2009 at 04:35:11PM +0100]
...
> +#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?
>

Give me some time Patrick, will try. Actually initial idea
of these macros was to eliminate 'possible' problems caused
by for (;;) form (enum could be rearranged and we will fail
silently). So I guess the some 'new' form of template would
help (instead of current "ctrl table as a templae"). So
will return with new proposal. Thanks for review!

	- Cyrill -