diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 295c97431e43..c04787ce1a71 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
| @@ -47,26 +47,6 @@ __nf_nat_proto_find(u_int8_t protonum) | |||
| 47 | return rcu_dereference(nf_nat_protos[protonum]); | 47 | return rcu_dereference(nf_nat_protos[protonum]); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static const struct nf_nat_protocol * | ||
| 51 | nf_nat_proto_find_get(u_int8_t protonum) | ||
| 52 | { | ||
| 53 | const struct nf_nat_protocol *p; | ||
| 54 | |||
| 55 | rcu_read_lock(); | ||
| 56 | p = __nf_nat_proto_find(protonum); | ||
| 57 | if (!try_module_get(p->me)) | ||
| 58 | p = &nf_nat_unknown_protocol; | ||
| 59 | rcu_read_unlock(); | ||
| 60 | |||
| 61 | return p; | ||
| 62 | } | ||
| 63 | |||
| 64 | static void | ||
| 65 | nf_nat_proto_put(const struct nf_nat_protocol *p) | ||
| 66 | { | ||
| 67 | module_put(p->me); | ||
| 68 | } | ||
| 69 | |||
| 70 | /* We keep an extra hash for each conntrack, for fast searching. */ | 50 | /* We keep an extra hash for each conntrack, for fast searching. */ |
| 71 | static inline unsigned int | 51 | static inline unsigned int |
| 72 | hash_by_src(const struct net *net, u16 zone, | 52 | hash_by_src(const struct net *net, u16 zone, |
| @@ -588,6 +568,26 @@ static struct nf_ct_ext_type nat_extend __read_mostly = { | |||
| 588 | #include <linux/netfilter/nfnetlink.h> | 568 | #include <linux/netfilter/nfnetlink.h> |
| 589 | #include <linux/netfilter/nfnetlink_conntrack.h> | 569 | #include <linux/netfilter/nfnetlink_conntrack.h> |
| 590 | 570 | ||
| 571 | static const struct nf_nat_protocol * | ||
| 572 | nf_nat_proto_find_get(u_int8_t protonum) | ||
| 573 | { | ||
| 574 | const struct nf_nat_protocol *p; | ||
| 575 | |||
| 576 | rcu_read_lock(); | ||
| 577 | p = __nf_nat_proto_find(protonum); | ||
| 578 | if (!try_module_get(p->me)) | ||
| 579 | p = &nf_nat_unknown_protocol; | ||
| 580 | rcu_read_unlock(); | ||
| 581 | |||
| 582 | return p; | ||
| 583 | } | ||
| 584 | |||
| 585 | static void | ||
| 586 | nf_nat_proto_put(const struct nf_nat_protocol *p) | ||
| 587 | { | ||
| 588 | module_put(p->me); | ||
| 589 | } | ||
| 590 | |||
| 591 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { | 591 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { |
| 592 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, | 592 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, |
| 593 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, | 593 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, |
