diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-08 05:35:05 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-10-08 05:35:05 -0400 |
commit | 74c51a1497033e6ff7b8096797daca233a4a30df (patch) | |
tree | cc5491a6e2cfcc71742e76226fcede365deba114 /net | |
parent | a702a65fc1376fc1f6757ec2a6960348af3f1876 (diff) |
netfilter: netns nf_conntrack: pass netns pointer to L4 protocol's ->error hook
Again, it's deducible from skb, but we're going to use it for
nf_conntrack_checksum and statistics, so just pass it from upper layer.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 8 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 9 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 12 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_dccp.c | 6 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_tcp.c | 3 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_udp.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_udplite.c | 4 |
7 files changed, 25 insertions, 19 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index daf346377b66..8c7ed5bc9590 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -123,7 +123,7 @@ static bool icmp_new(struct nf_conn *ct, const struct sk_buff *skb, | |||
123 | 123 | ||
124 | /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ | 124 | /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ |
125 | static int | 125 | static int |
126 | icmp_error_message(struct sk_buff *skb, | 126 | icmp_error_message(struct net *net, struct sk_buff *skb, |
127 | enum ip_conntrack_info *ctinfo, | 127 | enum ip_conntrack_info *ctinfo, |
128 | unsigned int hooknum) | 128 | unsigned int hooknum) |
129 | { | 129 | { |
@@ -155,7 +155,7 @@ icmp_error_message(struct sk_buff *skb, | |||
155 | 155 | ||
156 | *ctinfo = IP_CT_RELATED; | 156 | *ctinfo = IP_CT_RELATED; |
157 | 157 | ||
158 | h = nf_conntrack_find_get(&init_net, &innertuple); | 158 | h = nf_conntrack_find_get(net, &innertuple); |
159 | if (!h) { | 159 | if (!h) { |
160 | pr_debug("icmp_error_message: no match\n"); | 160 | pr_debug("icmp_error_message: no match\n"); |
161 | return -NF_ACCEPT; | 161 | return -NF_ACCEPT; |
@@ -172,7 +172,7 @@ icmp_error_message(struct sk_buff *skb, | |||
172 | 172 | ||
173 | /* Small and modified version of icmp_rcv */ | 173 | /* Small and modified version of icmp_rcv */ |
174 | static int | 174 | static int |
175 | icmp_error(struct sk_buff *skb, unsigned int dataoff, | 175 | icmp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, |
176 | enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) | 176 | enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) |
177 | { | 177 | { |
178 | const struct icmphdr *icmph; | 178 | const struct icmphdr *icmph; |
@@ -217,7 +217,7 @@ icmp_error(struct sk_buff *skb, unsigned int dataoff, | |||
217 | && icmph->type != ICMP_REDIRECT) | 217 | && icmph->type != ICMP_REDIRECT) |
218 | return NF_ACCEPT; | 218 | return NF_ACCEPT; |
219 | 219 | ||
220 | return icmp_error_message(skb, ctinfo, hooknum); | 220 | return icmp_error_message(net, skb, ctinfo, hooknum); |
221 | } | 221 | } |
222 | 222 | ||
223 | #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) | 223 | #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) |
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 548cf4f15c08..aabddfe21278 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -122,7 +122,8 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb, | |||
122 | } | 122 | } |
123 | 123 | ||
124 | static int | 124 | static int |
125 | icmpv6_error_message(struct sk_buff *skb, | 125 | icmpv6_error_message(struct net *net, |
126 | struct sk_buff *skb, | ||
126 | unsigned int icmp6off, | 127 | unsigned int icmp6off, |
127 | enum ip_conntrack_info *ctinfo, | 128 | enum ip_conntrack_info *ctinfo, |
128 | unsigned int hooknum) | 129 | unsigned int hooknum) |
@@ -156,7 +157,7 @@ icmpv6_error_message(struct sk_buff *skb, | |||
156 | 157 | ||
157 | *ctinfo = IP_CT_RELATED; | 158 | *ctinfo = IP_CT_RELATED; |
158 | 159 | ||
159 | h = nf_conntrack_find_get(&init_net, &intuple); | 160 | h = nf_conntrack_find_get(net, &intuple); |
160 | if (!h) { | 161 | if (!h) { |
161 | pr_debug("icmpv6_error: no match\n"); | 162 | pr_debug("icmpv6_error: no match\n"); |
162 | return -NF_ACCEPT; | 163 | return -NF_ACCEPT; |
@@ -172,7 +173,7 @@ icmpv6_error_message(struct sk_buff *skb, | |||
172 | } | 173 | } |
173 | 174 | ||
174 | static int | 175 | static int |
175 | icmpv6_error(struct sk_buff *skb, unsigned int dataoff, | 176 | icmpv6_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, |
176 | enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) | 177 | enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum) |
177 | { | 178 | { |
178 | const struct icmp6hdr *icmp6h; | 179 | const struct icmp6hdr *icmp6h; |
@@ -197,7 +198,7 @@ icmpv6_error(struct sk_buff *skb, unsigned int dataoff, | |||
197 | if (icmp6h->icmp6_type >= 128) | 198 | if (icmp6h->icmp6_type >= 128) |
198 | return NF_ACCEPT; | 199 | return NF_ACCEPT; |
199 | 200 | ||
200 | return icmpv6_error_message(skb, dataoff, ctinfo, hooknum); | 201 | return icmpv6_error_message(net, skb, dataoff, ctinfo, hooknum); |
201 | } | 202 | } |
202 | 203 | ||
203 | #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) | 204 | #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 5c96d9732c7b..251f020c7c10 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -703,11 +703,13 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum, | |||
703 | /* It may be an special packet, error, unclean... | 703 | /* It may be an special packet, error, unclean... |
704 | * inverse of the return code tells to the netfilter | 704 | * inverse of the return code tells to the netfilter |
705 | * core what to do with the packet. */ | 705 | * core what to do with the packet. */ |
706 | if (l4proto->error != NULL && | 706 | if (l4proto->error != NULL) { |
707 | (ret = l4proto->error(skb, dataoff, &ctinfo, pf, hooknum)) <= 0) { | 707 | ret = l4proto->error(net, skb, dataoff, &ctinfo, pf, hooknum); |
708 | NF_CT_STAT_INC_ATOMIC(error); | 708 | if (ret <= 0) { |
709 | NF_CT_STAT_INC_ATOMIC(invalid); | 709 | NF_CT_STAT_INC_ATOMIC(error); |
710 | return -ret; | 710 | NF_CT_STAT_INC_ATOMIC(invalid); |
711 | return -ret; | ||
712 | } | ||
711 | } | 713 | } |
712 | 714 | ||
713 | ct = resolve_normal_ct(net, skb, dataoff, pf, protonum, | 715 | ct = resolve_normal_ct(net, skb, dataoff, pf, protonum, |
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index edc30358dc19..6ead8da3e9e6 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
@@ -545,9 +545,9 @@ static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb, | |||
545 | return NF_ACCEPT; | 545 | return NF_ACCEPT; |
546 | } | 546 | } |
547 | 547 | ||
548 | static int dccp_error(struct sk_buff *skb, unsigned int dataoff, | 548 | static int dccp_error(struct net *net, struct sk_buff *skb, |
549 | enum ip_conntrack_info *ctinfo, u_int8_t pf, | 549 | unsigned int dataoff, enum ip_conntrack_info *ctinfo, |
550 | unsigned int hooknum) | 550 | u_int8_t pf, unsigned int hooknum) |
551 | { | 551 | { |
552 | struct dccp_hdr _dh, *dh; | 552 | struct dccp_hdr _dh, *dh; |
553 | unsigned int dccp_len = skb->len - dataoff; | 553 | unsigned int dccp_len = skb->len - dataoff; |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 539a8202025c..4e71de2405fb 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -746,7 +746,8 @@ static const u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) + 1] = | |||
746 | }; | 746 | }; |
747 | 747 | ||
748 | /* Protect conntrack agaist broken packets. Code taken from ipt_unclean.c. */ | 748 | /* Protect conntrack agaist broken packets. Code taken from ipt_unclean.c. */ |
749 | static int tcp_error(struct sk_buff *skb, | 749 | static int tcp_error(struct net *net, |
750 | struct sk_buff *skb, | ||
750 | unsigned int dataoff, | 751 | unsigned int dataoff, |
751 | enum ip_conntrack_info *ctinfo, | 752 | enum ip_conntrack_info *ctinfo, |
752 | u_int8_t pf, | 753 | u_int8_t pf, |
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index 2a965c4a0eac..8a245beb2c9e 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
@@ -89,7 +89,7 @@ static bool udp_new(struct nf_conn *ct, const struct sk_buff *skb, | |||
89 | return true; | 89 | return true; |
90 | } | 90 | } |
91 | 91 | ||
92 | static int udp_error(struct sk_buff *skb, unsigned int dataoff, | 92 | static int udp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, |
93 | enum ip_conntrack_info *ctinfo, | 93 | enum ip_conntrack_info *ctinfo, |
94 | u_int8_t pf, | 94 | u_int8_t pf, |
95 | unsigned int hooknum) | 95 | unsigned int hooknum) |
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c index 4fb6c8d83a84..981701919a75 100644 --- a/net/netfilter/nf_conntrack_proto_udplite.c +++ b/net/netfilter/nf_conntrack_proto_udplite.c | |||
@@ -89,7 +89,9 @@ static bool udplite_new(struct nf_conn *ct, const struct sk_buff *skb, | |||
89 | return true; | 89 | return true; |
90 | } | 90 | } |
91 | 91 | ||
92 | static int udplite_error(struct sk_buff *skb, unsigned int dataoff, | 92 | static int udplite_error(struct net *net, |
93 | struct sk_buff *skb, | ||
94 | unsigned int dataoff, | ||
93 | enum ip_conntrack_info *ctinfo, | 95 | enum ip_conntrack_info *ctinfo, |
94 | u_int8_t pf, | 96 | u_int8_t pf, |
95 | unsigned int hooknum) | 97 | unsigned int hooknum) |