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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux