Merge branch 'master' of git://1984.lsi.us.es/net-next
This commit is contained in:
@@ -333,6 +333,65 @@ MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6));
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Yasuyuki KOZAKAI @USAGI <yasuyuki.kozakai@toshiba.co.jp>");
|
||||
|
||||
static int ipv6_net_init(struct net *net)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = nf_conntrack_l4proto_register(net,
|
||||
&nf_conntrack_l4proto_tcp6);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "nf_conntrack_l4proto_tcp6: protocol register failed\n");
|
||||
goto out;
|
||||
}
|
||||
ret = nf_conntrack_l4proto_register(net,
|
||||
&nf_conntrack_l4proto_udp6);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "nf_conntrack_l4proto_udp6: protocol register failed\n");
|
||||
goto cleanup_tcp6;
|
||||
}
|
||||
ret = nf_conntrack_l4proto_register(net,
|
||||
&nf_conntrack_l4proto_icmpv6);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "nf_conntrack_l4proto_icmp6: protocol register failed\n");
|
||||
goto cleanup_udp6;
|
||||
}
|
||||
ret = nf_conntrack_l3proto_register(net,
|
||||
&nf_conntrack_l3proto_ipv6);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "nf_conntrack_l3proto_ipv6: protocol register failed\n");
|
||||
goto cleanup_icmpv6;
|
||||
}
|
||||
return 0;
|
||||
cleanup_icmpv6:
|
||||
nf_conntrack_l4proto_unregister(net,
|
||||
&nf_conntrack_l4proto_icmpv6);
|
||||
cleanup_udp6:
|
||||
nf_conntrack_l4proto_unregister(net,
|
||||
&nf_conntrack_l4proto_udp6);
|
||||
cleanup_tcp6:
|
||||
nf_conntrack_l4proto_unregister(net,
|
||||
&nf_conntrack_l4proto_tcp6);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ipv6_net_exit(struct net *net)
|
||||
{
|
||||
nf_conntrack_l3proto_unregister(net,
|
||||
&nf_conntrack_l3proto_ipv6);
|
||||
nf_conntrack_l4proto_unregister(net,
|
||||
&nf_conntrack_l4proto_icmpv6);
|
||||
nf_conntrack_l4proto_unregister(net,
|
||||
&nf_conntrack_l4proto_udp6);
|
||||
nf_conntrack_l4proto_unregister(net,
|
||||
&nf_conntrack_l4proto_tcp6);
|
||||
}
|
||||
|
||||
static struct pernet_operations ipv6_net_ops = {
|
||||
.init = ipv6_net_init,
|
||||
.exit = ipv6_net_exit,
|
||||
};
|
||||
|
||||
static int __init nf_conntrack_l3proto_ipv6_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -340,30 +399,9 @@ static int __init nf_conntrack_l3proto_ipv6_init(void)
|
||||
need_conntrack();
|
||||
nf_defrag_ipv6_enable();
|
||||
|
||||
ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_tcp6);
|
||||
if (ret < 0) {
|
||||
pr_err("nf_conntrack_ipv6: can't register tcp.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_udp6);
|
||||
if (ret < 0) {
|
||||
pr_err("nf_conntrack_ipv6: can't register udp.\n");
|
||||
goto cleanup_tcp;
|
||||
}
|
||||
|
||||
ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_icmpv6);
|
||||
if (ret < 0) {
|
||||
pr_err("nf_conntrack_ipv6: can't register icmpv6.\n");
|
||||
goto cleanup_udp;
|
||||
}
|
||||
|
||||
ret = nf_conntrack_l3proto_register(&nf_conntrack_l3proto_ipv6);
|
||||
if (ret < 0) {
|
||||
pr_err("nf_conntrack_ipv6: can't register ipv6\n");
|
||||
goto cleanup_icmpv6;
|
||||
}
|
||||
|
||||
ret = register_pernet_subsys(&ipv6_net_ops);
|
||||
if (ret < 0)
|
||||
goto cleanup_pernet;
|
||||
ret = nf_register_hooks(ipv6_conntrack_ops,
|
||||
ARRAY_SIZE(ipv6_conntrack_ops));
|
||||
if (ret < 0) {
|
||||
@@ -374,13 +412,8 @@ static int __init nf_conntrack_l3proto_ipv6_init(void)
|
||||
return ret;
|
||||
|
||||
cleanup_ipv6:
|
||||
nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv6);
|
||||
cleanup_icmpv6:
|
||||
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_icmpv6);
|
||||
cleanup_udp:
|
||||
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_udp6);
|
||||
cleanup_tcp:
|
||||
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_tcp6);
|
||||
unregister_pernet_subsys(&ipv6_net_ops);
|
||||
cleanup_pernet:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -388,10 +421,7 @@ static void __exit nf_conntrack_l3proto_ipv6_fini(void)
|
||||
{
|
||||
synchronize_net();
|
||||
nf_unregister_hooks(ipv6_conntrack_ops, ARRAY_SIZE(ipv6_conntrack_ops));
|
||||
nf_conntrack_l3proto_unregister(&nf_conntrack_l3proto_ipv6);
|
||||
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_icmpv6);
|
||||
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_udp6);
|
||||
nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_tcp6);
|
||||
unregister_pernet_subsys(&ipv6_net_ops);
|
||||
}
|
||||
|
||||
module_init(nf_conntrack_l3proto_ipv6_init);
|
||||
|
@@ -29,6 +29,11 @@
|
||||
|
||||
static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ;
|
||||
|
||||
static inline struct nf_icmp_net *icmpv6_pernet(struct net *net)
|
||||
{
|
||||
return &net->ct.nf_ct_proto.icmpv6;
|
||||
}
|
||||
|
||||
static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb,
|
||||
unsigned int dataoff,
|
||||
struct nf_conntrack_tuple *tuple)
|
||||
@@ -90,7 +95,7 @@ static int icmpv6_print_tuple(struct seq_file *s,
|
||||
|
||||
static unsigned int *icmpv6_get_timeouts(struct net *net)
|
||||
{
|
||||
return &nf_ct_icmpv6_timeout;
|
||||
return &icmpv6_pernet(net)->timeout;
|
||||
}
|
||||
|
||||
/* Returns verdict for packet, or -1 for invalid. */
|
||||
@@ -281,16 +286,18 @@ static int icmpv6_nlattr_tuple_size(void)
|
||||
#include <linux/netfilter/nfnetlink.h>
|
||||
#include <linux/netfilter/nfnetlink_cttimeout.h>
|
||||
|
||||
static int icmpv6_timeout_nlattr_to_obj(struct nlattr *tb[], void *data)
|
||||
static int icmpv6_timeout_nlattr_to_obj(struct nlattr *tb[],
|
||||
struct net *net, void *data)
|
||||
{
|
||||
unsigned int *timeout = data;
|
||||
struct nf_icmp_net *in = icmpv6_pernet(net);
|
||||
|
||||
if (tb[CTA_TIMEOUT_ICMPV6_TIMEOUT]) {
|
||||
*timeout =
|
||||
ntohl(nla_get_be32(tb[CTA_TIMEOUT_ICMPV6_TIMEOUT])) * HZ;
|
||||
} else {
|
||||
/* Set default ICMPv6 timeout. */
|
||||
*timeout = nf_ct_icmpv6_timeout;
|
||||
*timeout = in->timeout;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -315,11 +322,9 @@ icmpv6_timeout_nla_policy[CTA_TIMEOUT_ICMPV6_MAX+1] = {
|
||||
#endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static struct ctl_table_header *icmpv6_sysctl_header;
|
||||
static struct ctl_table icmpv6_sysctl_table[] = {
|
||||
{
|
||||
.procname = "nf_conntrack_icmpv6_timeout",
|
||||
.data = &nf_ct_icmpv6_timeout,
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_jiffies,
|
||||
@@ -328,6 +333,22 @@ static struct ctl_table icmpv6_sysctl_table[] = {
|
||||
};
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
static int icmpv6_init_net(struct net *net)
|
||||
{
|
||||
struct nf_icmp_net *in = icmpv6_pernet(net);
|
||||
struct nf_proto_net *pn = (struct nf_proto_net *)in;
|
||||
in->timeout = nf_ct_icmpv6_timeout;
|
||||
#ifdef CONFIG_SYSCTL
|
||||
pn->ctl_table = kmemdup(icmpv6_sysctl_table,
|
||||
sizeof(icmpv6_sysctl_table),
|
||||
GFP_KERNEL);
|
||||
if (!pn->ctl_table)
|
||||
return -ENOMEM;
|
||||
pn->ctl_table[0].data = &in->timeout;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =
|
||||
{
|
||||
.l3proto = PF_INET6,
|
||||
@@ -355,8 +376,5 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =
|
||||
.nla_policy = icmpv6_timeout_nla_policy,
|
||||
},
|
||||
#endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.ctl_table_header = &icmpv6_sysctl_header,
|
||||
.ctl_table = icmpv6_sysctl_table,
|
||||
#endif
|
||||
.init_net = icmpv6_init_net,
|
||||
};
|
||||
|
Reference in New Issue
Block a user