diff options
author | David S. Miller <davem@davemloft.net> | 2012-07-07 19:18:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-07 19:18:50 -0400 |
commit | d3a5ea6e2188adeea028c410c83c90e6b6d9347c (patch) | |
tree | 7035d790158da6fad3c482afa545b3dba2e6b037 /net/ipv4 | |
parent | 8ce5c9f27d2e2ce415d903d916e848a356d4c0c0 (diff) | |
parent | 46ba5a25f521e3c50d7bb81b1abb977769047456 (diff) |
Merge branch 'master' of git://1984.lsi.us.es/nf-next
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 041923cb67ad..5241d997ab75 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -337,34 +337,62 @@ static struct ctl_table icmp_compat_sysctl_table[] = { | |||
337 | #endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */ | 337 | #endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */ |
338 | #endif /* CONFIG_SYSCTL */ | 338 | #endif /* CONFIG_SYSCTL */ |
339 | 339 | ||
340 | static int icmp_init_net(struct net *net) | 340 | static int icmp_kmemdup_sysctl_table(struct nf_proto_net *pn, |
341 | struct nf_icmp_net *in) | ||
341 | { | 342 | { |
342 | struct nf_icmp_net *in = icmp_pernet(net); | ||
343 | struct nf_proto_net *pn = (struct nf_proto_net *)in; | ||
344 | in->timeout = nf_ct_icmp_timeout; | ||
345 | |||
346 | #ifdef CONFIG_SYSCTL | 343 | #ifdef CONFIG_SYSCTL |
347 | pn->ctl_table = kmemdup(icmp_sysctl_table, | 344 | pn->ctl_table = kmemdup(icmp_sysctl_table, |
348 | sizeof(icmp_sysctl_table), | 345 | sizeof(icmp_sysctl_table), |
349 | GFP_KERNEL); | 346 | GFP_KERNEL); |
350 | if (!pn->ctl_table) | 347 | if (!pn->ctl_table) |
351 | return -ENOMEM; | 348 | return -ENOMEM; |
349 | |||
352 | pn->ctl_table[0].data = &in->timeout; | 350 | pn->ctl_table[0].data = &in->timeout; |
351 | #endif | ||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static int icmp_kmemdup_compat_sysctl_table(struct nf_proto_net *pn, | ||
356 | struct nf_icmp_net *in) | ||
357 | { | ||
358 | #ifdef CONFIG_SYSCTL | ||
353 | #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT | 359 | #ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT |
354 | pn->ctl_compat_table = kmemdup(icmp_compat_sysctl_table, | 360 | pn->ctl_compat_table = kmemdup(icmp_compat_sysctl_table, |
355 | sizeof(icmp_compat_sysctl_table), | 361 | sizeof(icmp_compat_sysctl_table), |
356 | GFP_KERNEL); | 362 | GFP_KERNEL); |
357 | if (!pn->ctl_compat_table) { | 363 | if (!pn->ctl_compat_table) |
358 | kfree(pn->ctl_table); | ||
359 | pn->ctl_table = NULL; | ||
360 | return -ENOMEM; | 364 | return -ENOMEM; |
361 | } | 365 | |
362 | pn->ctl_compat_table[0].data = &in->timeout; | 366 | pn->ctl_compat_table[0].data = &in->timeout; |
363 | #endif | 367 | #endif |
364 | #endif | 368 | #endif |
365 | return 0; | 369 | return 0; |
366 | } | 370 | } |
367 | 371 | ||
372 | static int icmp_init_net(struct net *net, u_int16_t proto) | ||
373 | { | ||
374 | int ret; | ||
375 | struct nf_icmp_net *in = icmp_pernet(net); | ||
376 | struct nf_proto_net *pn = &in->pn; | ||
377 | |||
378 | in->timeout = nf_ct_icmp_timeout; | ||
379 | |||
380 | ret = icmp_kmemdup_compat_sysctl_table(pn, in); | ||
381 | if (ret < 0) | ||
382 | return ret; | ||
383 | |||
384 | ret = icmp_kmemdup_sysctl_table(pn, in); | ||
385 | if (ret < 0) | ||
386 | nf_ct_kfree_compat_sysctl_table(pn); | ||
387 | |||
388 | return ret; | ||
389 | } | ||
390 | |||
391 | static struct nf_proto_net *icmp_get_net_proto(struct net *net) | ||
392 | { | ||
393 | return &net->ct.nf_ct_proto.icmp.pn; | ||
394 | } | ||
395 | |||
368 | struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp __read_mostly = | 396 | struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp __read_mostly = |
369 | { | 397 | { |
370 | .l3proto = PF_INET, | 398 | .l3proto = PF_INET, |
@@ -395,4 +423,5 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp __read_mostly = | |||
395 | }, | 423 | }, |
396 | #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */ | 424 | #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */ |
397 | .init_net = icmp_init_net, | 425 | .init_net = icmp_init_net, |
426 | .get_net_proto = icmp_get_net_proto, | ||
398 | }; | 427 | }; |