diff options
author | David S. Miller <davem@davemloft.net> | 2014-09-02 16:56:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-02 16:56:30 -0400 |
commit | abccc5878a31bc921e9b1e254c74ea20761f4c4b (patch) | |
tree | 5f3c42549b5a323ea4a3f5c6c074dc410e5359d1 | |
parent | 04860eb7d911bbd958463416cc045b69ffdf73b3 (diff) | |
parent | d79a61d646db950b68dd79ecc627cb5f11e0d8ac (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Pablo Neira Ayuso says:
====================
pull request: Netfilter/IPVS fixes for net
The following patchset contains seven Netfilter fixes for your net
tree, they are:
1) Make the NAT infrastructure independent of x_tables, some users are
already starting to test nf_tables with NAT without enabling x_tables.
Without this patch for Kconfig, there's a superfluous dependency
between NAT and x_tables.
2) Allow to use 0 in the cgroup match, the kernel rejects with -EINVAL
with no good reason. From Daniel Borkmann.
3) Select CONFIG_NF_NAT from the nf_tables NAT expression, this also
resolves another NAT dependency with x_tables.
4) Use HAVE_JUMP_LABEL instead of CONFIG_JUMP_LABEL in the Netfilter hook
code as elsewhere in the kernel to resolve toolchain problems, from
Zhouyi Zhou.
5) Use iptunnel_handle_offloads() to set up tunnel encapsulation
depending on the offload capabilities, reported by Alex Gartrell
patch from Julian Anastasov.
6) Fix wrong family when registering the ip_vs_local_reply6() hook,
also from Julian.
7) Select the NF_LOG_* symbols from NETFILTER_XT_TARGET_LOG. Rafał
Miłecki reported that when jumping from 3.16 to 3.17-rc, his log
target is not selected anymore due to changes in the previous
development cycle to accomodate the full logging support for
nf_tables.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netfilter.h | 5 | ||||
-rw-r--r-- | net/ipv4/netfilter/Kconfig | 102 | ||||
-rw-r--r-- | net/ipv4/netfilter/Makefile | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/Kconfig | 26 | ||||
-rw-r--r-- | net/ipv6/netfilter/Makefile | 2 | ||||
-rw-r--r-- | net/netfilter/Kconfig | 6 | ||||
-rw-r--r-- | net/netfilter/Makefile | 2 | ||||
-rw-r--r-- | net/netfilter/core.c | 6 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_core.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_xmit.c | 20 | ||||
-rw-r--r-- | net/netfilter/xt_cgroup.c | 2 |
11 files changed, 105 insertions, 70 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 2077489f9887..2517ece98820 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/in6.h> | 9 | #include <linux/in6.h> |
10 | #include <linux/wait.h> | 10 | #include <linux/wait.h> |
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | #include <linux/static_key.h> | ||
12 | #include <uapi/linux/netfilter.h> | 13 | #include <uapi/linux/netfilter.h> |
13 | #ifdef CONFIG_NETFILTER | 14 | #ifdef CONFIG_NETFILTER |
14 | static inline int NF_DROP_GETERR(int verdict) | 15 | static inline int NF_DROP_GETERR(int verdict) |
@@ -99,9 +100,9 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg); | |||
99 | 100 | ||
100 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 101 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
101 | 102 | ||
102 | #if defined(CONFIG_JUMP_LABEL) | 103 | #ifdef HAVE_JUMP_LABEL |
103 | #include <linux/static_key.h> | ||
104 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 104 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
105 | |||
105 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) | 106 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) |
106 | { | 107 | { |
107 | if (__builtin_constant_p(pf) && | 108 | if (__builtin_constant_p(pf) && |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index fb173126f03d..7cbcaf4f0194 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -82,6 +82,52 @@ config NF_TABLES_ARP | |||
82 | help | 82 | help |
83 | This option enables the ARP support for nf_tables. | 83 | This option enables the ARP support for nf_tables. |
84 | 84 | ||
85 | config NF_NAT_IPV4 | ||
86 | tristate "IPv4 NAT" | ||
87 | depends on NF_CONNTRACK_IPV4 | ||
88 | default m if NETFILTER_ADVANCED=n | ||
89 | select NF_NAT | ||
90 | help | ||
91 | The IPv4 NAT option allows masquerading, port forwarding and other | ||
92 | forms of full Network Address Port Translation. This can be | ||
93 | controlled by iptables or nft. | ||
94 | |||
95 | if NF_NAT_IPV4 | ||
96 | |||
97 | config NF_NAT_SNMP_BASIC | ||
98 | tristate "Basic SNMP-ALG support" | ||
99 | depends on NF_CONNTRACK_SNMP | ||
100 | depends on NETFILTER_ADVANCED | ||
101 | default NF_NAT && NF_CONNTRACK_SNMP | ||
102 | ---help--- | ||
103 | |||
104 | This module implements an Application Layer Gateway (ALG) for | ||
105 | SNMP payloads. In conjunction with NAT, it allows a network | ||
106 | management system to access multiple private networks with | ||
107 | conflicting addresses. It works by modifying IP addresses | ||
108 | inside SNMP payloads to match IP-layer NAT mapping. | ||
109 | |||
110 | This is the "basic" form of SNMP-ALG, as described in RFC 2962 | ||
111 | |||
112 | To compile it as a module, choose M here. If unsure, say N. | ||
113 | |||
114 | config NF_NAT_PROTO_GRE | ||
115 | tristate | ||
116 | depends on NF_CT_PROTO_GRE | ||
117 | |||
118 | config NF_NAT_PPTP | ||
119 | tristate | ||
120 | depends on NF_CONNTRACK | ||
121 | default NF_CONNTRACK_PPTP | ||
122 | select NF_NAT_PROTO_GRE | ||
123 | |||
124 | config NF_NAT_H323 | ||
125 | tristate | ||
126 | depends on NF_CONNTRACK | ||
127 | default NF_CONNTRACK_H323 | ||
128 | |||
129 | endif # NF_NAT_IPV4 | ||
130 | |||
85 | config IP_NF_IPTABLES | 131 | config IP_NF_IPTABLES |
86 | tristate "IP tables support (required for filtering/masq/NAT)" | 132 | tristate "IP tables support (required for filtering/masq/NAT)" |
87 | default m if NETFILTER_ADVANCED=n | 133 | default m if NETFILTER_ADVANCED=n |
@@ -170,19 +216,21 @@ config IP_NF_TARGET_SYNPROXY | |||
170 | To compile it as a module, choose M here. If unsure, say N. | 216 | To compile it as a module, choose M here. If unsure, say N. |
171 | 217 | ||
172 | # NAT + specific targets: nf_conntrack | 218 | # NAT + specific targets: nf_conntrack |
173 | config NF_NAT_IPV4 | 219 | config IP_NF_NAT |
174 | tristate "IPv4 NAT" | 220 | tristate "iptables NAT support" |
175 | depends on NF_CONNTRACK_IPV4 | 221 | depends on NF_CONNTRACK_IPV4 |
176 | default m if NETFILTER_ADVANCED=n | 222 | default m if NETFILTER_ADVANCED=n |
177 | select NF_NAT | 223 | select NF_NAT |
224 | select NF_NAT_IPV4 | ||
225 | select NETFILTER_XT_NAT | ||
178 | help | 226 | help |
179 | The IPv4 NAT option allows masquerading, port forwarding and other | 227 | This enables the `nat' table in iptables. This allows masquerading, |
180 | forms of full Network Address Port Translation. It is controlled by | 228 | port forwarding and other forms of full Network Address Port |
181 | the `nat' table in iptables: see the man page for iptables(8). | 229 | Translation. |
182 | 230 | ||
183 | To compile it as a module, choose M here. If unsure, say N. | 231 | To compile it as a module, choose M here. If unsure, say N. |
184 | 232 | ||
185 | if NF_NAT_IPV4 | 233 | if IP_NF_NAT |
186 | 234 | ||
187 | config IP_NF_TARGET_MASQUERADE | 235 | config IP_NF_TARGET_MASQUERADE |
188 | tristate "MASQUERADE target support" | 236 | tristate "MASQUERADE target support" |
@@ -214,47 +262,7 @@ config IP_NF_TARGET_REDIRECT | |||
214 | (e.g. when running oldconfig). It selects | 262 | (e.g. when running oldconfig). It selects |
215 | CONFIG_NETFILTER_XT_TARGET_REDIRECT. | 263 | CONFIG_NETFILTER_XT_TARGET_REDIRECT. |
216 | 264 | ||
217 | endif | 265 | endif # IP_NF_NAT |
218 | |||
219 | config NF_NAT_SNMP_BASIC | ||
220 | tristate "Basic SNMP-ALG support" | ||
221 | depends on NF_CONNTRACK_SNMP && NF_NAT_IPV4 | ||
222 | depends on NETFILTER_ADVANCED | ||
223 | default NF_NAT && NF_CONNTRACK_SNMP | ||
224 | ---help--- | ||
225 | |||
226 | This module implements an Application Layer Gateway (ALG) for | ||
227 | SNMP payloads. In conjunction with NAT, it allows a network | ||
228 | management system to access multiple private networks with | ||
229 | conflicting addresses. It works by modifying IP addresses | ||
230 | inside SNMP payloads to match IP-layer NAT mapping. | ||
231 | |||
232 | This is the "basic" form of SNMP-ALG, as described in RFC 2962 | ||
233 | |||
234 | To compile it as a module, choose M here. If unsure, say N. | ||
235 | |||
236 | # If they want FTP, set to $CONFIG_IP_NF_NAT (m or y), | ||
237 | # or $CONFIG_IP_NF_FTP (m or y), whichever is weaker. | ||
238 | # From kconfig-language.txt: | ||
239 | # | ||
240 | # <expr> '&&' <expr> (6) | ||
241 | # | ||
242 | # (6) Returns the result of min(/expr/, /expr/). | ||
243 | |||
244 | config NF_NAT_PROTO_GRE | ||
245 | tristate | ||
246 | depends on NF_NAT_IPV4 && NF_CT_PROTO_GRE | ||
247 | |||
248 | config NF_NAT_PPTP | ||
249 | tristate | ||
250 | depends on NF_CONNTRACK && NF_NAT_IPV4 | ||
251 | default NF_NAT_IPV4 && NF_CONNTRACK_PPTP | ||
252 | select NF_NAT_PROTO_GRE | ||
253 | |||
254 | config NF_NAT_H323 | ||
255 | tristate | ||
256 | depends on NF_CONNTRACK && NF_NAT_IPV4 | ||
257 | default NF_NAT_IPV4 && NF_CONNTRACK_H323 | ||
258 | 266 | ||
259 | # mangle + specific targets | 267 | # mangle + specific targets |
260 | config IP_NF_MANGLE | 268 | config IP_NF_MANGLE |
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index 33001621465b..edf4af32e9f2 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile | |||
@@ -43,7 +43,7 @@ obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o | |||
43 | # the three instances of ip_tables | 43 | # the three instances of ip_tables |
44 | obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o | 44 | obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o |
45 | obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o | 45 | obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o |
46 | obj-$(CONFIG_NF_NAT_IPV4) += iptable_nat.o | 46 | obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o |
47 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o | 47 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o |
48 | obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o | 48 | obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o |
49 | 49 | ||
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index ac93df16f5af..cf0b88f30f6f 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
@@ -60,6 +60,16 @@ config NF_LOG_IPV6 | |||
60 | depends on NETFILTER_ADVANCED | 60 | depends on NETFILTER_ADVANCED |
61 | select NF_LOG_COMMON | 61 | select NF_LOG_COMMON |
62 | 62 | ||
63 | config NF_NAT_IPV6 | ||
64 | tristate "IPv6 NAT" | ||
65 | depends on NF_CONNTRACK_IPV6 | ||
66 | depends on NETFILTER_ADVANCED | ||
67 | select NF_NAT | ||
68 | help | ||
69 | The IPv6 NAT option allows masquerading, port forwarding and other | ||
70 | forms of full Network Address Port Translation. This can be | ||
71 | controlled by iptables or nft. | ||
72 | |||
63 | config IP6_NF_IPTABLES | 73 | config IP6_NF_IPTABLES |
64 | tristate "IP6 tables support (required for filtering)" | 74 | tristate "IP6 tables support (required for filtering)" |
65 | depends on INET && IPV6 | 75 | depends on INET && IPV6 |
@@ -232,19 +242,21 @@ config IP6_NF_SECURITY | |||
232 | 242 | ||
233 | If unsure, say N. | 243 | If unsure, say N. |
234 | 244 | ||
235 | config NF_NAT_IPV6 | 245 | config IP6_NF_NAT |
236 | tristate "IPv6 NAT" | 246 | tristate "ip6tables NAT support" |
237 | depends on NF_CONNTRACK_IPV6 | 247 | depends on NF_CONNTRACK_IPV6 |
238 | depends on NETFILTER_ADVANCED | 248 | depends on NETFILTER_ADVANCED |
239 | select NF_NAT | 249 | select NF_NAT |
250 | select NF_NAT_IPV6 | ||
251 | select NETFILTER_XT_NAT | ||
240 | help | 252 | help |
241 | The IPv6 NAT option allows masquerading, port forwarding and other | 253 | This enables the `nat' table in ip6tables. This allows masquerading, |
242 | forms of full Network Address Port Translation. It is controlled by | 254 | port forwarding and other forms of full Network Address Port |
243 | the `nat' table in ip6tables, see the man page for ip6tables(8). | 255 | Translation. |
244 | 256 | ||
245 | To compile it as a module, choose M here. If unsure, say N. | 257 | To compile it as a module, choose M here. If unsure, say N. |
246 | 258 | ||
247 | if NF_NAT_IPV6 | 259 | if IP6_NF_NAT |
248 | 260 | ||
249 | config IP6_NF_TARGET_MASQUERADE | 261 | config IP6_NF_TARGET_MASQUERADE |
250 | tristate "MASQUERADE target support" | 262 | tristate "MASQUERADE target support" |
@@ -265,7 +277,7 @@ config IP6_NF_TARGET_NPT | |||
265 | 277 | ||
266 | To compile it as a module, choose M here. If unsure, say N. | 278 | To compile it as a module, choose M here. If unsure, say N. |
267 | 279 | ||
268 | endif # NF_NAT_IPV6 | 280 | endif # IP6_NF_NAT |
269 | 281 | ||
270 | endif # IP6_NF_IPTABLES | 282 | endif # IP6_NF_IPTABLES |
271 | 283 | ||
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile index c0b263104ed2..c3d3286db4bb 100644 --- a/net/ipv6/netfilter/Makefile +++ b/net/ipv6/netfilter/Makefile | |||
@@ -8,7 +8,7 @@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o | |||
8 | obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o | 8 | obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o |
9 | obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o | 9 | obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o |
10 | obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o | 10 | obj-$(CONFIG_IP6_NF_SECURITY) += ip6table_security.o |
11 | obj-$(CONFIG_NF_NAT_IPV6) += ip6table_nat.o | 11 | obj-$(CONFIG_IP6_NF_NAT) += ip6table_nat.o |
12 | 12 | ||
13 | # objects for l3 independent conntrack | 13 | # objects for l3 independent conntrack |
14 | nf_conntrack_ipv6-y := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o | 14 | nf_conntrack_ipv6-y := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index ad751fe2e82b..4bef6eb7c40d 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -499,7 +499,7 @@ config NFT_LIMIT | |||
499 | config NFT_NAT | 499 | config NFT_NAT |
500 | depends on NF_TABLES | 500 | depends on NF_TABLES |
501 | depends on NF_CONNTRACK | 501 | depends on NF_CONNTRACK |
502 | depends on NF_NAT | 502 | select NF_NAT |
503 | tristate "Netfilter nf_tables nat module" | 503 | tristate "Netfilter nf_tables nat module" |
504 | help | 504 | help |
505 | This option adds the "nat" expression that you can use to perform | 505 | This option adds the "nat" expression that you can use to perform |
@@ -747,7 +747,9 @@ config NETFILTER_XT_TARGET_LED | |||
747 | 747 | ||
748 | config NETFILTER_XT_TARGET_LOG | 748 | config NETFILTER_XT_TARGET_LOG |
749 | tristate "LOG target support" | 749 | tristate "LOG target support" |
750 | depends on NF_LOG_IPV4 && NF_LOG_IPV6 | 750 | select NF_LOG_COMMON |
751 | select NF_LOG_IPV4 | ||
752 | select NF_LOG_IPV6 if IPV6 | ||
751 | default m if NETFILTER_ADVANCED=n | 753 | default m if NETFILTER_ADVANCED=n |
752 | help | 754 | help |
753 | This option adds a `LOG' target, which allows you to create rules in | 755 | This option adds a `LOG' target, which allows you to create rules in |
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile index 8308624a406a..fad5fdba34e5 100644 --- a/net/netfilter/Makefile +++ b/net/netfilter/Makefile | |||
@@ -95,7 +95,7 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o | |||
95 | obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o | 95 | obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o |
96 | obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o | 96 | obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o |
97 | obj-$(CONFIG_NETFILTER_XT_SET) += xt_set.o | 97 | obj-$(CONFIG_NETFILTER_XT_SET) += xt_set.o |
98 | obj-$(CONFIG_NF_NAT) += xt_nat.o | 98 | obj-$(CONFIG_NETFILTER_XT_NAT) += xt_nat.o |
99 | 99 | ||
100 | # targets | 100 | # targets |
101 | obj-$(CONFIG_NETFILTER_XT_TARGET_AUDIT) += xt_AUDIT.o | 101 | obj-$(CONFIG_NETFILTER_XT_TARGET_AUDIT) += xt_AUDIT.o |
diff --git a/net/netfilter/core.c b/net/netfilter/core.c index a93c97f106d4..024a2e25c8a4 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c | |||
@@ -54,7 +54,7 @@ EXPORT_SYMBOL_GPL(nf_unregister_afinfo); | |||
54 | struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly; | 54 | struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly; |
55 | EXPORT_SYMBOL(nf_hooks); | 55 | EXPORT_SYMBOL(nf_hooks); |
56 | 56 | ||
57 | #if defined(CONFIG_JUMP_LABEL) | 57 | #ifdef HAVE_JUMP_LABEL |
58 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 58 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
59 | EXPORT_SYMBOL(nf_hooks_needed); | 59 | EXPORT_SYMBOL(nf_hooks_needed); |
60 | #endif | 60 | #endif |
@@ -72,7 +72,7 @@ int nf_register_hook(struct nf_hook_ops *reg) | |||
72 | } | 72 | } |
73 | list_add_rcu(®->list, elem->list.prev); | 73 | list_add_rcu(®->list, elem->list.prev); |
74 | mutex_unlock(&nf_hook_mutex); | 74 | mutex_unlock(&nf_hook_mutex); |
75 | #if defined(CONFIG_JUMP_LABEL) | 75 | #ifdef HAVE_JUMP_LABEL |
76 | static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]); | 76 | static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]); |
77 | #endif | 77 | #endif |
78 | return 0; | 78 | return 0; |
@@ -84,7 +84,7 @@ void nf_unregister_hook(struct nf_hook_ops *reg) | |||
84 | mutex_lock(&nf_hook_mutex); | 84 | mutex_lock(&nf_hook_mutex); |
85 | list_del_rcu(®->list); | 85 | list_del_rcu(®->list); |
86 | mutex_unlock(&nf_hook_mutex); | 86 | mutex_unlock(&nf_hook_mutex); |
87 | #if defined(CONFIG_JUMP_LABEL) | 87 | #ifdef HAVE_JUMP_LABEL |
88 | static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]); | 88 | static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]); |
89 | #endif | 89 | #endif |
90 | synchronize_net(); | 90 | synchronize_net(); |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index e6836755c45d..5c34e8d42e01 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1906,7 +1906,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = { | |||
1906 | { | 1906 | { |
1907 | .hook = ip_vs_local_reply6, | 1907 | .hook = ip_vs_local_reply6, |
1908 | .owner = THIS_MODULE, | 1908 | .owner = THIS_MODULE, |
1909 | .pf = NFPROTO_IPV4, | 1909 | .pf = NFPROTO_IPV6, |
1910 | .hooknum = NF_INET_LOCAL_OUT, | 1910 | .hooknum = NF_INET_LOCAL_OUT, |
1911 | .priority = NF_IP6_PRI_NAT_DST + 1, | 1911 | .priority = NF_IP6_PRI_NAT_DST + 1, |
1912 | }, | 1912 | }, |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 6f70bdd3a90a..56896a412bce 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <net/route.h> /* for ip_route_output */ | 38 | #include <net/route.h> /* for ip_route_output */ |
39 | #include <net/ipv6.h> | 39 | #include <net/ipv6.h> |
40 | #include <net/ip6_route.h> | 40 | #include <net/ip6_route.h> |
41 | #include <net/ip_tunnels.h> | ||
41 | #include <net/addrconf.h> | 42 | #include <net/addrconf.h> |
42 | #include <linux/icmpv6.h> | 43 | #include <linux/icmpv6.h> |
43 | #include <linux/netfilter.h> | 44 | #include <linux/netfilter.h> |
@@ -862,11 +863,15 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
862 | old_iph = ip_hdr(skb); | 863 | old_iph = ip_hdr(skb); |
863 | } | 864 | } |
864 | 865 | ||
865 | skb->transport_header = skb->network_header; | ||
866 | |||
867 | /* fix old IP header checksum */ | 866 | /* fix old IP header checksum */ |
868 | ip_send_check(old_iph); | 867 | ip_send_check(old_iph); |
869 | 868 | ||
869 | skb = iptunnel_handle_offloads(skb, false, SKB_GSO_IPIP); | ||
870 | if (IS_ERR(skb)) | ||
871 | goto tx_error; | ||
872 | |||
873 | skb->transport_header = skb->network_header; | ||
874 | |||
870 | skb_push(skb, sizeof(struct iphdr)); | 875 | skb_push(skb, sizeof(struct iphdr)); |
871 | skb_reset_network_header(skb); | 876 | skb_reset_network_header(skb); |
872 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 877 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
@@ -900,7 +905,8 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
900 | return NF_STOLEN; | 905 | return NF_STOLEN; |
901 | 906 | ||
902 | tx_error: | 907 | tx_error: |
903 | kfree_skb(skb); | 908 | if (!IS_ERR(skb)) |
909 | kfree_skb(skb); | ||
904 | rcu_read_unlock(); | 910 | rcu_read_unlock(); |
905 | LeaveFunction(10); | 911 | LeaveFunction(10); |
906 | return NF_STOLEN; | 912 | return NF_STOLEN; |
@@ -953,6 +959,11 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
953 | old_iph = ipv6_hdr(skb); | 959 | old_iph = ipv6_hdr(skb); |
954 | } | 960 | } |
955 | 961 | ||
962 | /* GSO: we need to provide proper SKB_GSO_ value for IPv6 */ | ||
963 | skb = iptunnel_handle_offloads(skb, false, 0); /* SKB_GSO_SIT/IPV6 */ | ||
964 | if (IS_ERR(skb)) | ||
965 | goto tx_error; | ||
966 | |||
956 | skb->transport_header = skb->network_header; | 967 | skb->transport_header = skb->network_header; |
957 | 968 | ||
958 | skb_push(skb, sizeof(struct ipv6hdr)); | 969 | skb_push(skb, sizeof(struct ipv6hdr)); |
@@ -988,7 +999,8 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
988 | return NF_STOLEN; | 999 | return NF_STOLEN; |
989 | 1000 | ||
990 | tx_error: | 1001 | tx_error: |
991 | kfree_skb(skb); | 1002 | if (!IS_ERR(skb)) |
1003 | kfree_skb(skb); | ||
992 | rcu_read_unlock(); | 1004 | rcu_read_unlock(); |
993 | LeaveFunction(10); | 1005 | LeaveFunction(10); |
994 | return NF_STOLEN; | 1006 | return NF_STOLEN; |
diff --git a/net/netfilter/xt_cgroup.c b/net/netfilter/xt_cgroup.c index f4e833005320..7198d660b4de 100644 --- a/net/netfilter/xt_cgroup.c +++ b/net/netfilter/xt_cgroup.c | |||
@@ -31,7 +31,7 @@ static int cgroup_mt_check(const struct xt_mtchk_param *par) | |||
31 | if (info->invert & ~1) | 31 | if (info->invert & ~1) |
32 | return -EINVAL; | 32 | return -EINVAL; |
33 | 33 | ||
34 | return info->id ? 0 : -EINVAL; | 34 | return 0; |
35 | } | 35 | } |
36 | 36 | ||
37 | static bool | 37 | static bool |