diff options
-rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack.h | 1 | ||||
-rw-r--r-- | include/linux/sysctl.h | 2 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 1 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_proto_icmp.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_proto_tcp.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_proto_udp.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_standalone.c | 11 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_tcp.c | 5 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_udp.c | 3 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_standalone.c | 11 |
12 files changed, 36 insertions, 8 deletions
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index d54d7b278e96..5473c01f69ea 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h | |||
@@ -293,6 +293,7 @@ static inline int is_dying(struct ip_conntrack *ct) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | extern unsigned int ip_conntrack_htable_size; | 295 | extern unsigned int ip_conntrack_htable_size; |
296 | extern int ip_conntrack_checksum; | ||
296 | 297 | ||
297 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) | 298 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) |
298 | 299 | ||
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index cd9e7c0825ad..98338ed2c0b6 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -313,6 +313,7 @@ enum | |||
313 | NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, | 313 | NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, |
314 | NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, | 314 | NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, |
315 | NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, | 315 | NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, |
316 | NET_NF_CONNTRACK_CHECKSUM=32, | ||
316 | }; | 317 | }; |
317 | 318 | ||
318 | /* /proc/sys/net/ipv4 */ | 319 | /* /proc/sys/net/ipv4 */ |
@@ -492,6 +493,7 @@ enum | |||
492 | NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, | 493 | NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, |
493 | NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, | 494 | NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, |
494 | NET_IPV4_NF_CONNTRACK_COUNT=27, | 495 | NET_IPV4_NF_CONNTRACK_COUNT=27, |
496 | NET_IPV4_NF_CONNTRACK_CHECKSUM=28, | ||
495 | }; | 497 | }; |
496 | 498 | ||
497 | /* /proc/sys/net/ipv6 */ | 499 | /* /proc/sys/net/ipv6 */ |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 916013ca4a5c..dbe7a114d0c5 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -285,6 +285,7 @@ static inline int nf_ct_is_dying(struct nf_conn *ct) | |||
285 | } | 285 | } |
286 | 286 | ||
287 | extern unsigned int nf_conntrack_htable_size; | 287 | extern unsigned int nf_conntrack_htable_size; |
288 | extern int nf_conntrack_checksum; | ||
288 | 289 | ||
289 | #define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) | 290 | #define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) |
290 | 291 | ||
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c index d8b14a9010a6..23f1c504586d 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c | |||
@@ -224,7 +224,7 @@ icmp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, | |||
224 | } | 224 | } |
225 | 225 | ||
226 | /* See ip_conntrack_proto_tcp.c */ | 226 | /* See ip_conntrack_proto_tcp.c */ |
227 | if (hooknum == NF_IP_PRE_ROUTING && | 227 | if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING && |
228 | nf_ip_checksum(skb, hooknum, skb->nh.iph->ihl * 4, 0)) { | 228 | nf_ip_checksum(skb, hooknum, skb->nh.iph->ihl * 4, 0)) { |
229 | if (LOG_INVALID(IPPROTO_ICMP)) | 229 | if (LOG_INVALID(IPPROTO_ICMP)) |
230 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, | 230 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index 062b252b58ad..c5c2ce5cdeb8 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c | |||
@@ -870,7 +870,7 @@ static int tcp_error(struct sk_buff *skb, | |||
870 | * and moreover root might send raw packets. | 870 | * and moreover root might send raw packets. |
871 | */ | 871 | */ |
872 | /* FIXME: Source route IP option packets --RR */ | 872 | /* FIXME: Source route IP option packets --RR */ |
873 | if (hooknum == NF_IP_PRE_ROUTING && | 873 | if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING && |
874 | nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_TCP)) { | 874 | nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_TCP)) { |
875 | if (LOG_INVALID(IPPROTO_TCP)) | 875 | if (LOG_INVALID(IPPROTO_TCP)) |
876 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, | 876 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c index 70899868783b..9b2c16b4d2ff 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c | |||
@@ -120,7 +120,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, | |||
120 | * because the semantic of CHECKSUM_HW is different there | 120 | * because the semantic of CHECKSUM_HW is different there |
121 | * and moreover root might send raw packets. | 121 | * and moreover root might send raw packets. |
122 | * FIXME: Source route IP option packets --RR */ | 122 | * FIXME: Source route IP option packets --RR */ |
123 | if (hooknum == NF_IP_PRE_ROUTING && | 123 | if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING && |
124 | nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) { | 124 | nf_ip_checksum(skb, hooknum, iph->ihl * 4, IPPROTO_UDP)) { |
125 | if (LOG_INVALID(IPPROTO_UDP)) | 125 | if (LOG_INVALID(IPPROTO_UDP)) |
126 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, | 126 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index f0cc7feb0da3..6cb9b989d14c 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c | |||
@@ -564,6 +564,8 @@ extern unsigned int ip_ct_generic_timeout; | |||
564 | static int log_invalid_proto_min = 0; | 564 | static int log_invalid_proto_min = 0; |
565 | static int log_invalid_proto_max = 255; | 565 | static int log_invalid_proto_max = 255; |
566 | 566 | ||
567 | int ip_conntrack_checksum = 1; | ||
568 | |||
567 | static struct ctl_table_header *ip_ct_sysctl_header; | 569 | static struct ctl_table_header *ip_ct_sysctl_header; |
568 | 570 | ||
569 | static ctl_table ip_ct_sysctl_table[] = { | 571 | static ctl_table ip_ct_sysctl_table[] = { |
@@ -592,6 +594,14 @@ static ctl_table ip_ct_sysctl_table[] = { | |||
592 | .proc_handler = &proc_dointvec, | 594 | .proc_handler = &proc_dointvec, |
593 | }, | 595 | }, |
594 | { | 596 | { |
597 | .ctl_name = NET_IPV4_NF_CONNTRACK_CHECKSUM, | ||
598 | .procname = "ip_conntrack_checksum", | ||
599 | .data = &ip_conntrack_checksum, | ||
600 | .maxlen = sizeof(int), | ||
601 | .mode = 0644, | ||
602 | .proc_handler = &proc_dointvec, | ||
603 | }, | ||
604 | { | ||
595 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, | 605 | .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, |
596 | .procname = "ip_conntrack_tcp_timeout_syn_sent", | 606 | .procname = "ip_conntrack_tcp_timeout_syn_sent", |
597 | .data = &ip_ct_tcp_timeout_syn_sent, | 607 | .data = &ip_ct_tcp_timeout_syn_sent, |
@@ -946,6 +956,7 @@ EXPORT_SYMBOL_GPL(__ip_conntrack_helper_find_byname); | |||
946 | EXPORT_SYMBOL_GPL(ip_conntrack_proto_find_get); | 956 | EXPORT_SYMBOL_GPL(ip_conntrack_proto_find_get); |
947 | EXPORT_SYMBOL_GPL(ip_conntrack_proto_put); | 957 | EXPORT_SYMBOL_GPL(ip_conntrack_proto_put); |
948 | EXPORT_SYMBOL_GPL(__ip_conntrack_proto_find); | 958 | EXPORT_SYMBOL_GPL(__ip_conntrack_proto_find); |
959 | EXPORT_SYMBOL_GPL(ip_conntrack_checksum); | ||
949 | #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ | 960 | #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ |
950 | defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) | 961 | defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) |
951 | EXPORT_SYMBOL_GPL(ip_ct_port_tuple_to_nfattr); | 962 | EXPORT_SYMBOL_GPL(ip_ct_port_tuple_to_nfattr); |
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 4b0d361cc6e6..663a73ee3f2f 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -235,7 +235,7 @@ icmp_error(struct sk_buff *skb, unsigned int dataoff, | |||
235 | } | 235 | } |
236 | 236 | ||
237 | /* See ip_conntrack_proto_tcp.c */ | 237 | /* See ip_conntrack_proto_tcp.c */ |
238 | if (hooknum == NF_IP_PRE_ROUTING && | 238 | if (nf_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING && |
239 | nf_ip_checksum(skb, hooknum, dataoff, 0)) { | 239 | nf_ip_checksum(skb, hooknum, dataoff, 0)) { |
240 | if (LOG_INVALID(IPPROTO_ICMP)) | 240 | if (LOG_INVALID(IPPROTO_ICMP)) |
241 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, | 241 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 86c6703265d0..ef18a7b7014b 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -233,7 +233,7 @@ icmpv6_error(struct sk_buff *skb, unsigned int dataoff, | |||
233 | return -NF_ACCEPT; | 233 | return -NF_ACCEPT; |
234 | } | 234 | } |
235 | 235 | ||
236 | if (hooknum == NF_IP6_PRE_ROUTING && | 236 | if (nf_conntrack_checksum && hooknum == NF_IP6_PRE_ROUTING && |
237 | nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) { | 237 | nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) { |
238 | nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, | 238 | nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, |
239 | "nf_ct_icmpv6: ICMPv6 checksum failed\n"); | 239 | "nf_ct_icmpv6: ICMPv6 checksum failed\n"); |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 69899f27d26a..12fb7c0a1509 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -828,8 +828,9 @@ static int tcp_error(struct sk_buff *skb, | |||
828 | * and moreover root might send raw packets. | 828 | * and moreover root might send raw packets. |
829 | */ | 829 | */ |
830 | /* FIXME: Source route IP option packets --RR */ | 830 | /* FIXME: Source route IP option packets --RR */ |
831 | if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || | 831 | if (nf_conntrack_checksum && |
832 | (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) && | 832 | ((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || |
833 | (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) && | ||
833 | nf_checksum(skb, hooknum, dataoff, IPPROTO_TCP, pf)) { | 834 | nf_checksum(skb, hooknum, dataoff, IPPROTO_TCP, pf)) { |
834 | if (LOG_INVALID(IPPROTO_TCP)) | 835 | if (LOG_INVALID(IPPROTO_TCP)) |
835 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 836 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index d93edbfde9e3..ae07ebe3ab37 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
@@ -134,7 +134,8 @@ static int udp_error(struct sk_buff *skb, unsigned int dataoff, | |||
134 | * because the semantic of CHECKSUM_HW is different there | 134 | * because the semantic of CHECKSUM_HW is different there |
135 | * and moreover root might send raw packets. | 135 | * and moreover root might send raw packets. |
136 | * FIXME: Source route IP option packets --RR */ | 136 | * FIXME: Source route IP option packets --RR */ |
137 | if (((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || | 137 | if (nf_conntrack_checksum && |
138 | ((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) || | ||
138 | (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) && | 139 | (pf == PF_INET6 && hooknum == NF_IP6_PRE_ROUTING)) && |
139 | nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) { | 140 | nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) { |
140 | if (LOG_INVALID(IPPROTO_UDP)) | 141 | if (LOG_INVALID(IPPROTO_UDP)) |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 408960c6a544..e01d20d8e287 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -455,6 +455,8 @@ extern unsigned int nf_ct_generic_timeout; | |||
455 | static int log_invalid_proto_min = 0; | 455 | static int log_invalid_proto_min = 0; |
456 | static int log_invalid_proto_max = 255; | 456 | static int log_invalid_proto_max = 255; |
457 | 457 | ||
458 | int nf_conntrack_checksum = 1; | ||
459 | |||
458 | static struct ctl_table_header *nf_ct_sysctl_header; | 460 | static struct ctl_table_header *nf_ct_sysctl_header; |
459 | 461 | ||
460 | static ctl_table nf_ct_sysctl_table[] = { | 462 | static ctl_table nf_ct_sysctl_table[] = { |
@@ -483,6 +485,14 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
483 | .proc_handler = &proc_dointvec, | 485 | .proc_handler = &proc_dointvec, |
484 | }, | 486 | }, |
485 | { | 487 | { |
488 | .ctl_name = NET_NF_CONNTRACK_CHECKSUM, | ||
489 | .procname = "nf_conntrack_checksum", | ||
490 | .data = &nf_conntrack_checksum, | ||
491 | .maxlen = sizeof(unsigned int), | ||
492 | .mode = 0644, | ||
493 | .proc_handler = &proc_dointvec, | ||
494 | }, | ||
495 | { | ||
486 | .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, | 496 | .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, |
487 | .procname = "nf_conntrack_tcp_timeout_syn_sent", | 497 | .procname = "nf_conntrack_tcp_timeout_syn_sent", |
488 | .data = &nf_ct_tcp_timeout_syn_sent, | 498 | .data = &nf_ct_tcp_timeout_syn_sent, |
@@ -851,6 +861,7 @@ EXPORT_SYMBOL(nf_ct_proto_put); | |||
851 | EXPORT_SYMBOL(nf_ct_l3proto_find_get); | 861 | EXPORT_SYMBOL(nf_ct_l3proto_find_get); |
852 | EXPORT_SYMBOL(nf_ct_l3proto_put); | 862 | EXPORT_SYMBOL(nf_ct_l3proto_put); |
853 | EXPORT_SYMBOL(nf_ct_l3protos); | 863 | EXPORT_SYMBOL(nf_ct_l3protos); |
864 | EXPORT_SYMBOL_GPL(nf_conntrack_checksum); | ||
854 | EXPORT_SYMBOL(nf_conntrack_expect_alloc); | 865 | EXPORT_SYMBOL(nf_conntrack_expect_alloc); |
855 | EXPORT_SYMBOL(nf_conntrack_expect_put); | 866 | EXPORT_SYMBOL(nf_conntrack_expect_put); |
856 | EXPORT_SYMBOL(nf_conntrack_expect_related); | 867 | EXPORT_SYMBOL(nf_conntrack_expect_related); |