diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-23 20:10:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-23 20:10:10 -0400 |
commit | 0b4a9e1a591ca92726d32dbe043eb737734c6a0e (patch) | |
tree | 8ee8e13183bc1852073e9a592780f069d73954f5 | |
parent | dfbce08c19cba2ba4faaf8c0dd6d7678f46c78dd (diff) | |
parent | 8e36c4b5b673edc6081599b8bd461e062e4910f4 (diff) |
Merge branch 'master' of git://1984.lsi.us.es/nf-next
Pablo says:
====================
The following four patches provide Netfilter fixes for the cthelper
infrastructure that was recently merged mainstream, they are:
* two fixes for compilation breakage with two different configurations:
- CONFIG_NF_NAT=m and CONFIG_NF_CT_NETLINK=y
- NF_CONNTRACK_EVENTS=n and CONFIG_NETFILTER_NETLINK_QUEUE_CT=y
* two fixes for sparse warnings.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netfilter.h | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 6 | ||||
-rw-r--r-- | net/netfilter/core.c | 5 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 5 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue_ct.c | 9 |
5 files changed, 21 insertions, 10 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index dca19e61b30a..c613cf0d7884 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -401,10 +401,14 @@ struct nfq_ct_hook { | |||
401 | size_t (*build_size)(const struct nf_conn *ct); | 401 | size_t (*build_size)(const struct nf_conn *ct); |
402 | int (*build)(struct sk_buff *skb, struct nf_conn *ct); | 402 | int (*build)(struct sk_buff *skb, struct nf_conn *ct); |
403 | int (*parse)(const struct nlattr *attr, struct nf_conn *ct); | 403 | int (*parse)(const struct nlattr *attr, struct nf_conn *ct); |
404 | }; | ||
405 | extern struct nfq_ct_hook __rcu *nfq_ct_hook; | ||
406 | |||
407 | struct nfq_ct_nat_hook { | ||
404 | void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct, | 408 | void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct, |
405 | u32 ctinfo, int off); | 409 | u32 ctinfo, int off); |
406 | }; | 410 | }; |
407 | extern struct nfq_ct_hook *nfq_ct_hook; | 411 | extern struct nfq_ct_nat_hook __rcu *nfq_ct_nat_hook; |
408 | #else | 412 | #else |
409 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | 413 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} |
410 | #endif | 414 | #endif |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index abb52adf5acd..44b082fd48ab 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -691,6 +691,10 @@ static struct nf_ct_helper_expectfn follow_master_nat = { | |||
691 | .expectfn = nf_nat_follow_master, | 691 | .expectfn = nf_nat_follow_master, |
692 | }; | 692 | }; |
693 | 693 | ||
694 | static struct nfq_ct_nat_hook nfq_ct_nat = { | ||
695 | .seq_adjust = nf_nat_tcp_seq_adjust, | ||
696 | }; | ||
697 | |||
694 | static int __init nf_nat_init(void) | 698 | static int __init nf_nat_init(void) |
695 | { | 699 | { |
696 | size_t i; | 700 | size_t i; |
@@ -731,6 +735,7 @@ static int __init nf_nat_init(void) | |||
731 | nfnetlink_parse_nat_setup); | 735 | nfnetlink_parse_nat_setup); |
732 | BUG_ON(nf_ct_nat_offset != NULL); | 736 | BUG_ON(nf_ct_nat_offset != NULL); |
733 | RCU_INIT_POINTER(nf_ct_nat_offset, nf_nat_get_offset); | 737 | RCU_INIT_POINTER(nf_ct_nat_offset, nf_nat_get_offset); |
738 | RCU_INIT_POINTER(nfq_ct_nat_hook, &nfq_ct_nat); | ||
734 | return 0; | 739 | return 0; |
735 | 740 | ||
736 | cleanup_extend: | 741 | cleanup_extend: |
@@ -747,6 +752,7 @@ static void __exit nf_nat_cleanup(void) | |||
747 | RCU_INIT_POINTER(nf_nat_seq_adjust_hook, NULL); | 752 | RCU_INIT_POINTER(nf_nat_seq_adjust_hook, NULL); |
748 | RCU_INIT_POINTER(nfnetlink_parse_nat_setup_hook, NULL); | 753 | RCU_INIT_POINTER(nfnetlink_parse_nat_setup_hook, NULL); |
749 | RCU_INIT_POINTER(nf_ct_nat_offset, NULL); | 754 | RCU_INIT_POINTER(nf_ct_nat_offset, NULL); |
755 | RCU_INIT_POINTER(nfq_ct_nat_hook, NULL); | ||
750 | synchronize_net(); | 756 | synchronize_net(); |
751 | } | 757 | } |
752 | 758 | ||
diff --git a/net/netfilter/core.c b/net/netfilter/core.c index 7eef8453b909..0bc6b60db4df 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c | |||
@@ -265,9 +265,12 @@ void nf_conntrack_destroy(struct nf_conntrack *nfct) | |||
265 | } | 265 | } |
266 | EXPORT_SYMBOL(nf_conntrack_destroy); | 266 | EXPORT_SYMBOL(nf_conntrack_destroy); |
267 | 267 | ||
268 | struct nfq_ct_hook *nfq_ct_hook; | 268 | struct nfq_ct_hook __rcu *nfq_ct_hook __read_mostly; |
269 | EXPORT_SYMBOL_GPL(nfq_ct_hook); | 269 | EXPORT_SYMBOL_GPL(nfq_ct_hook); |
270 | 270 | ||
271 | struct nfq_ct_nat_hook __rcu *nfq_ct_nat_hook __read_mostly; | ||
272 | EXPORT_SYMBOL_GPL(nfq_ct_nat_hook); | ||
273 | |||
271 | #endif /* CONFIG_NF_CONNTRACK */ | 274 | #endif /* CONFIG_NF_CONNTRACK */ |
272 | 275 | ||
273 | #ifdef CONFIG_PROC_FS | 276 | #ifdef CONFIG_PROC_FS |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 31d1d8f3a6ce..b9b8f4ac7a36 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -478,7 +478,6 @@ nla_put_failure: | |||
478 | return -1; | 478 | return -1; |
479 | } | 479 | } |
480 | 480 | ||
481 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
482 | static inline size_t | 481 | static inline size_t |
483 | ctnetlink_proto_size(const struct nf_conn *ct) | 482 | ctnetlink_proto_size(const struct nf_conn *ct) |
484 | { | 483 | { |
@@ -565,6 +564,7 @@ ctnetlink_nlmsg_size(const struct nf_conn *ct) | |||
565 | ; | 564 | ; |
566 | } | 565 | } |
567 | 566 | ||
567 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
568 | static int | 568 | static int |
569 | ctnetlink_conntrack_event(unsigned int events, struct nf_ct_event *item) | 569 | ctnetlink_conntrack_event(unsigned int events, struct nf_ct_event *item) |
570 | { | 570 | { |
@@ -1757,9 +1757,6 @@ static struct nfq_ct_hook ctnetlink_nfqueue_hook = { | |||
1757 | .build_size = ctnetlink_nfqueue_build_size, | 1757 | .build_size = ctnetlink_nfqueue_build_size, |
1758 | .build = ctnetlink_nfqueue_build, | 1758 | .build = ctnetlink_nfqueue_build, |
1759 | .parse = ctnetlink_nfqueue_parse, | 1759 | .parse = ctnetlink_nfqueue_parse, |
1760 | #ifdef CONFIG_NF_NAT_NEEDED | ||
1761 | .seq_adjust = nf_nat_tcp_seq_adjust, | ||
1762 | #endif | ||
1763 | }; | 1760 | }; |
1764 | #endif /* CONFIG_NETFILTER_NETLINK_QUEUE_CT */ | 1761 | #endif /* CONFIG_NETFILTER_NETLINK_QUEUE_CT */ |
1765 | 1762 | ||
diff --git a/net/netfilter/nfnetlink_queue_ct.c b/net/netfilter/nfnetlink_queue_ct.c index 68ef550066f5..ab61d66bc0b9 100644 --- a/net/netfilter/nfnetlink_queue_ct.c +++ b/net/netfilter/nfnetlink_queue_ct.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/netfilter/nfnetlink.h> | 12 | #include <linux/netfilter/nfnetlink.h> |
13 | #include <linux/netfilter/nfnetlink_queue.h> | 13 | #include <linux/netfilter/nfnetlink_queue.h> |
14 | #include <net/netfilter/nf_conntrack.h> | 14 | #include <net/netfilter/nf_conntrack.h> |
15 | #include <net/netfilter/nfnetlink_queue.h> | ||
15 | 16 | ||
16 | struct nf_conn *nfqnl_ct_get(struct sk_buff *entskb, size_t *size, | 17 | struct nf_conn *nfqnl_ct_get(struct sk_buff *entskb, size_t *size, |
17 | enum ip_conntrack_info *ctinfo) | 18 | enum ip_conntrack_info *ctinfo) |
@@ -86,12 +87,12 @@ nla_put_failure: | |||
86 | void nfqnl_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct, | 87 | void nfqnl_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct, |
87 | enum ip_conntrack_info ctinfo, int diff) | 88 | enum ip_conntrack_info ctinfo, int diff) |
88 | { | 89 | { |
89 | struct nfq_ct_hook *nfq_ct; | 90 | struct nfq_ct_nat_hook *nfq_nat_ct; |
90 | 91 | ||
91 | nfq_ct = rcu_dereference(nfq_ct_hook); | 92 | nfq_nat_ct = rcu_dereference(nfq_ct_nat_hook); |
92 | if (nfq_ct == NULL) | 93 | if (nfq_nat_ct == NULL) |
93 | return; | 94 | return; |
94 | 95 | ||
95 | if ((ct->status & IPS_NAT_MASK) && diff) | 96 | if ((ct->status & IPS_NAT_MASK) && diff) |
96 | nfq_ct->seq_adjust(skb, ct, ctinfo, diff); | 97 | nfq_nat_ct->seq_adjust(skb, ct, ctinfo, diff); |
97 | } | 98 | } |