diff options
-rw-r--r-- | include/net/netfilter/nf_conntrack_l4proto.h | 15 | ||||
-rw-r--r-- | include/net/netns/conntrack.h | 1 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 6 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 1 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_dccp.c | 10 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_tcp.c | 18 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_udp.c | 6 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_udplite.c | 8 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_standalone.c | 6 |
11 files changed, 39 insertions, 36 deletions
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 97723d33c950..7f2f43c77284 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -117,20 +117,19 @@ extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], | |||
117 | struct nf_conntrack_tuple *t); | 117 | struct nf_conntrack_tuple *t); |
118 | extern const struct nla_policy nf_ct_port_nla_policy[]; | 118 | extern const struct nla_policy nf_ct_port_nla_policy[]; |
119 | 119 | ||
120 | /* Log invalid packets */ | ||
121 | extern unsigned int nf_ct_log_invalid; | ||
122 | |||
123 | #ifdef CONFIG_SYSCTL | 120 | #ifdef CONFIG_SYSCTL |
124 | #ifdef DEBUG_INVALID_PACKETS | 121 | #ifdef DEBUG_INVALID_PACKETS |
125 | #define LOG_INVALID(proto) \ | 122 | #define LOG_INVALID(net, proto) \ |
126 | (nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) | 123 | ((net)->ct.sysctl_log_invalid == (proto) || \ |
124 | (net)->ct.sysctl_log_invalid == IPPROTO_RAW) | ||
127 | #else | 125 | #else |
128 | #define LOG_INVALID(proto) \ | 126 | #define LOG_INVALID(net, proto) \ |
129 | ((nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) \ | 127 | (((net)->ct.sysctl_log_invalid == (proto) || \ |
128 | (net)->ct.sysctl_log_invalid == IPPROTO_RAW) \ | ||
130 | && net_ratelimit()) | 129 | && net_ratelimit()) |
131 | #endif | 130 | #endif |
132 | #else | 131 | #else |
133 | #define LOG_INVALID(proto) 0 | 132 | #define LOG_INVALID(net, proto) 0 |
134 | #endif /* CONFIG_SYSCTL */ | 133 | #endif /* CONFIG_SYSCTL */ |
135 | 134 | ||
136 | #endif /*_NF_CONNTRACK_PROTOCOL_H*/ | 135 | #endif /*_NF_CONNTRACK_PROTOCOL_H*/ |
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 38b6dae4d3de..503e37551b17 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
@@ -18,6 +18,7 @@ struct netns_ct { | |||
18 | struct nf_conntrack_ecache *ecache; | 18 | struct nf_conntrack_ecache *ecache; |
19 | #endif | 19 | #endif |
20 | int sysctl_checksum; | 20 | int sysctl_checksum; |
21 | unsigned int sysctl_log_invalid; /* Log invalid packets */ | ||
21 | #ifdef CONFIG_SYSCTL | 22 | #ifdef CONFIG_SYSCTL |
22 | struct ctl_table_header *sysctl_header; | 23 | struct ctl_table_header *sysctl_header; |
23 | #endif | 24 | #endif |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index 75871b1dd8a8..af69acc1d0f8 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -278,7 +278,7 @@ static ctl_table ip_ct_sysctl_table[] = { | |||
278 | { | 278 | { |
279 | .ctl_name = NET_IPV4_NF_CONNTRACK_LOG_INVALID, | 279 | .ctl_name = NET_IPV4_NF_CONNTRACK_LOG_INVALID, |
280 | .procname = "ip_conntrack_log_invalid", | 280 | .procname = "ip_conntrack_log_invalid", |
281 | .data = &nf_ct_log_invalid, | 281 | .data = &init_net.ct.sysctl_log_invalid, |
282 | .maxlen = sizeof(unsigned int), | 282 | .maxlen = sizeof(unsigned int), |
283 | .mode = 0644, | 283 | .mode = 0644, |
284 | .proc_handler = &proc_dointvec_minmax, | 284 | .proc_handler = &proc_dointvec_minmax, |
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index ace66cbf9215..4e8879220222 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -181,7 +181,7 @@ icmp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | |||
181 | /* Not enough header? */ | 181 | /* Not enough header? */ |
182 | icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); | 182 | icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); |
183 | if (icmph == NULL) { | 183 | if (icmph == NULL) { |
184 | if (LOG_INVALID(IPPROTO_ICMP)) | 184 | if (LOG_INVALID(net, IPPROTO_ICMP)) |
185 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, | 185 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
186 | "nf_ct_icmp: short packet "); | 186 | "nf_ct_icmp: short packet "); |
187 | return -NF_ACCEPT; | 187 | return -NF_ACCEPT; |
@@ -190,7 +190,7 @@ icmp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | |||
190 | /* See ip_conntrack_proto_tcp.c */ | 190 | /* See ip_conntrack_proto_tcp.c */ |
191 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && | 191 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && |
192 | nf_ip_checksum(skb, hooknum, dataoff, 0)) { | 192 | nf_ip_checksum(skb, hooknum, dataoff, 0)) { |
193 | if (LOG_INVALID(IPPROTO_ICMP)) | 193 | if (LOG_INVALID(net, IPPROTO_ICMP)) |
194 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, | 194 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
195 | "nf_ct_icmp: bad HW ICMP checksum "); | 195 | "nf_ct_icmp: bad HW ICMP checksum "); |
196 | return -NF_ACCEPT; | 196 | return -NF_ACCEPT; |
@@ -203,7 +203,7 @@ icmp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | |||
203 | * discarded. | 203 | * discarded. |
204 | */ | 204 | */ |
205 | if (icmph->type > NR_ICMP_TYPES) { | 205 | if (icmph->type > NR_ICMP_TYPES) { |
206 | if (LOG_INVALID(IPPROTO_ICMP)) | 206 | if (LOG_INVALID(net, IPPROTO_ICMP)) |
207 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, | 207 | nf_log_packet(PF_INET, 0, skb, NULL, NULL, NULL, |
208 | "nf_ct_icmp: invalid ICMP type "); | 208 | "nf_ct_icmp: invalid ICMP type "); |
209 | return -NF_ACCEPT; | 209 | return -NF_ACCEPT; |
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index fa12e57749ab..05726177903f 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -181,7 +181,7 @@ icmpv6_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | |||
181 | 181 | ||
182 | icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); | 182 | icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); |
183 | if (icmp6h == NULL) { | 183 | if (icmp6h == NULL) { |
184 | if (LOG_INVALID(IPPROTO_ICMPV6)) | 184 | if (LOG_INVALID(net, IPPROTO_ICMPV6)) |
185 | nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, | 185 | nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL, |
186 | "nf_ct_icmpv6: short packet "); | 186 | "nf_ct_icmpv6: short packet "); |
187 | return -NF_ACCEPT; | 187 | return -NF_ACCEPT; |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 1e87fa0cd3af..ade0bb3ab2e3 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -53,7 +53,6 @@ EXPORT_SYMBOL_GPL(nf_conntrack_max); | |||
53 | struct nf_conn nf_conntrack_untracked __read_mostly; | 53 | struct nf_conn nf_conntrack_untracked __read_mostly; |
54 | EXPORT_SYMBOL_GPL(nf_conntrack_untracked); | 54 | EXPORT_SYMBOL_GPL(nf_conntrack_untracked); |
55 | 55 | ||
56 | unsigned int nf_ct_log_invalid __read_mostly; | ||
57 | static struct kmem_cache *nf_conntrack_cachep __read_mostly; | 56 | static struct kmem_cache *nf_conntrack_cachep __read_mostly; |
58 | 57 | ||
59 | static int nf_conntrack_hash_rnd_initted; | 58 | static int nf_conntrack_hash_rnd_initted; |
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index 769680e68b5e..8fcf1762fabf 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
@@ -418,6 +418,7 @@ static bool dccp_invert_tuple(struct nf_conntrack_tuple *inv, | |||
418 | static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb, | 418 | static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb, |
419 | unsigned int dataoff) | 419 | unsigned int dataoff) |
420 | { | 420 | { |
421 | struct net *net = nf_ct_net(ct); | ||
421 | struct dccp_hdr _dh, *dh; | 422 | struct dccp_hdr _dh, *dh; |
422 | const char *msg; | 423 | const char *msg; |
423 | u_int8_t state; | 424 | u_int8_t state; |
@@ -445,7 +446,7 @@ static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb, | |||
445 | return true; | 446 | return true; |
446 | 447 | ||
447 | out_invalid: | 448 | out_invalid: |
448 | if (LOG_INVALID(IPPROTO_DCCP)) | 449 | if (LOG_INVALID(net, IPPROTO_DCCP)) |
449 | nf_log_packet(nf_ct_l3num(ct), 0, skb, NULL, NULL, NULL, msg); | 450 | nf_log_packet(nf_ct_l3num(ct), 0, skb, NULL, NULL, NULL, msg); |
450 | return false; | 451 | return false; |
451 | } | 452 | } |
@@ -463,6 +464,7 @@ static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb, | |||
463 | unsigned int dataoff, enum ip_conntrack_info ctinfo, | 464 | unsigned int dataoff, enum ip_conntrack_info ctinfo, |
464 | u_int8_t pf, unsigned int hooknum) | 465 | u_int8_t pf, unsigned int hooknum) |
465 | { | 466 | { |
467 | struct net *net = nf_ct_net(ct); | ||
466 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); | 468 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); |
467 | struct dccp_hdr _dh, *dh; | 469 | struct dccp_hdr _dh, *dh; |
468 | u_int8_t type, old_state, new_state; | 470 | u_int8_t type, old_state, new_state; |
@@ -524,13 +526,13 @@ static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb, | |||
524 | ct->proto.dccp.last_pkt = type; | 526 | ct->proto.dccp.last_pkt = type; |
525 | 527 | ||
526 | write_unlock_bh(&dccp_lock); | 528 | write_unlock_bh(&dccp_lock); |
527 | if (LOG_INVALID(IPPROTO_DCCP)) | 529 | if (LOG_INVALID(net, IPPROTO_DCCP)) |
528 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 530 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
529 | "nf_ct_dccp: invalid packet ignored "); | 531 | "nf_ct_dccp: invalid packet ignored "); |
530 | return NF_ACCEPT; | 532 | return NF_ACCEPT; |
531 | case CT_DCCP_INVALID: | 533 | case CT_DCCP_INVALID: |
532 | write_unlock_bh(&dccp_lock); | 534 | write_unlock_bh(&dccp_lock); |
533 | if (LOG_INVALID(IPPROTO_DCCP)) | 535 | if (LOG_INVALID(net, IPPROTO_DCCP)) |
534 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 536 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
535 | "nf_ct_dccp: invalid state transition "); | 537 | "nf_ct_dccp: invalid state transition "); |
536 | return -NF_ACCEPT; | 538 | return -NF_ACCEPT; |
@@ -590,7 +592,7 @@ static int dccp_error(struct net *net, struct sk_buff *skb, | |||
590 | return NF_ACCEPT; | 592 | return NF_ACCEPT; |
591 | 593 | ||
592 | out_invalid: | 594 | out_invalid: |
593 | if (LOG_INVALID(IPPROTO_DCCP)) | 595 | if (LOG_INVALID(net, IPPROTO_DCCP)) |
594 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, msg); | 596 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, msg); |
595 | return -NF_ACCEPT; | 597 | return -NF_ACCEPT; |
596 | } | 598 | } |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 131c9be4470a..f947ec41e391 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -488,6 +488,7 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
488 | const struct tcphdr *tcph, | 488 | const struct tcphdr *tcph, |
489 | u_int8_t pf) | 489 | u_int8_t pf) |
490 | { | 490 | { |
491 | struct net *net = nf_ct_net(ct); | ||
491 | struct ip_ct_tcp_state *sender = &state->seen[dir]; | 492 | struct ip_ct_tcp_state *sender = &state->seen[dir]; |
492 | struct ip_ct_tcp_state *receiver = &state->seen[!dir]; | 493 | struct ip_ct_tcp_state *receiver = &state->seen[!dir]; |
493 | const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; | 494 | const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; |
@@ -668,7 +669,7 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
668 | if (sender->flags & IP_CT_TCP_FLAG_BE_LIBERAL || | 669 | if (sender->flags & IP_CT_TCP_FLAG_BE_LIBERAL || |
669 | nf_ct_tcp_be_liberal) | 670 | nf_ct_tcp_be_liberal) |
670 | res = true; | 671 | res = true; |
671 | if (!res && LOG_INVALID(IPPROTO_TCP)) | 672 | if (!res && LOG_INVALID(net, IPPROTO_TCP)) |
672 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 673 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
673 | "nf_ct_tcp: %s ", | 674 | "nf_ct_tcp: %s ", |
674 | before(seq, sender->td_maxend + 1) ? | 675 | before(seq, sender->td_maxend + 1) ? |
@@ -761,7 +762,7 @@ static int tcp_error(struct net *net, | |||
761 | /* Smaller that minimal TCP header? */ | 762 | /* Smaller that minimal TCP header? */ |
762 | th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph); | 763 | th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph); |
763 | if (th == NULL) { | 764 | if (th == NULL) { |
764 | if (LOG_INVALID(IPPROTO_TCP)) | 765 | if (LOG_INVALID(net, IPPROTO_TCP)) |
765 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 766 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
766 | "nf_ct_tcp: short packet "); | 767 | "nf_ct_tcp: short packet "); |
767 | return -NF_ACCEPT; | 768 | return -NF_ACCEPT; |
@@ -769,7 +770,7 @@ static int tcp_error(struct net *net, | |||
769 | 770 | ||
770 | /* Not whole TCP header or malformed packet */ | 771 | /* Not whole TCP header or malformed packet */ |
771 | if (th->doff*4 < sizeof(struct tcphdr) || tcplen < th->doff*4) { | 772 | if (th->doff*4 < sizeof(struct tcphdr) || tcplen < th->doff*4) { |
772 | if (LOG_INVALID(IPPROTO_TCP)) | 773 | if (LOG_INVALID(net, IPPROTO_TCP)) |
773 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 774 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
774 | "nf_ct_tcp: truncated/malformed packet "); | 775 | "nf_ct_tcp: truncated/malformed packet "); |
775 | return -NF_ACCEPT; | 776 | return -NF_ACCEPT; |
@@ -782,7 +783,7 @@ static int tcp_error(struct net *net, | |||
782 | /* FIXME: Source route IP option packets --RR */ | 783 | /* FIXME: Source route IP option packets --RR */ |
783 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && | 784 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && |
784 | nf_checksum(skb, hooknum, dataoff, IPPROTO_TCP, pf)) { | 785 | nf_checksum(skb, hooknum, dataoff, IPPROTO_TCP, pf)) { |
785 | if (LOG_INVALID(IPPROTO_TCP)) | 786 | if (LOG_INVALID(net, IPPROTO_TCP)) |
786 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 787 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
787 | "nf_ct_tcp: bad TCP checksum "); | 788 | "nf_ct_tcp: bad TCP checksum "); |
788 | return -NF_ACCEPT; | 789 | return -NF_ACCEPT; |
@@ -791,7 +792,7 @@ static int tcp_error(struct net *net, | |||
791 | /* Check TCP flags. */ | 792 | /* Check TCP flags. */ |
792 | tcpflags = (((u_int8_t *)th)[13] & ~(TH_ECE|TH_CWR|TH_PUSH)); | 793 | tcpflags = (((u_int8_t *)th)[13] & ~(TH_ECE|TH_CWR|TH_PUSH)); |
793 | if (!tcp_valid_flags[tcpflags]) { | 794 | if (!tcp_valid_flags[tcpflags]) { |
794 | if (LOG_INVALID(IPPROTO_TCP)) | 795 | if (LOG_INVALID(net, IPPROTO_TCP)) |
795 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 796 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
796 | "nf_ct_tcp: invalid TCP flag combination "); | 797 | "nf_ct_tcp: invalid TCP flag combination "); |
797 | return -NF_ACCEPT; | 798 | return -NF_ACCEPT; |
@@ -808,6 +809,7 @@ static int tcp_packet(struct nf_conn *ct, | |||
808 | u_int8_t pf, | 809 | u_int8_t pf, |
809 | unsigned int hooknum) | 810 | unsigned int hooknum) |
810 | { | 811 | { |
812 | struct net *net = nf_ct_net(ct); | ||
811 | struct nf_conntrack_tuple *tuple; | 813 | struct nf_conntrack_tuple *tuple; |
812 | enum tcp_conntrack new_state, old_state; | 814 | enum tcp_conntrack new_state, old_state; |
813 | enum ip_conntrack_dir dir; | 815 | enum ip_conntrack_dir dir; |
@@ -886,7 +888,7 @@ static int tcp_packet(struct nf_conn *ct, | |||
886 | * thus initiate a clean new session. | 888 | * thus initiate a clean new session. |
887 | */ | 889 | */ |
888 | write_unlock_bh(&tcp_lock); | 890 | write_unlock_bh(&tcp_lock); |
889 | if (LOG_INVALID(IPPROTO_TCP)) | 891 | if (LOG_INVALID(net, IPPROTO_TCP)) |
890 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 892 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
891 | "nf_ct_tcp: killing out of sync session "); | 893 | "nf_ct_tcp: killing out of sync session "); |
892 | nf_ct_kill(ct); | 894 | nf_ct_kill(ct); |
@@ -899,7 +901,7 @@ static int tcp_packet(struct nf_conn *ct, | |||
899 | segment_seq_plus_len(ntohl(th->seq), skb->len, dataoff, th); | 901 | segment_seq_plus_len(ntohl(th->seq), skb->len, dataoff, th); |
900 | 902 | ||
901 | write_unlock_bh(&tcp_lock); | 903 | write_unlock_bh(&tcp_lock); |
902 | if (LOG_INVALID(IPPROTO_TCP)) | 904 | if (LOG_INVALID(net, IPPROTO_TCP)) |
903 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 905 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
904 | "nf_ct_tcp: invalid packet ignored "); | 906 | "nf_ct_tcp: invalid packet ignored "); |
905 | return NF_ACCEPT; | 907 | return NF_ACCEPT; |
@@ -908,7 +910,7 @@ static int tcp_packet(struct nf_conn *ct, | |||
908 | pr_debug("nf_ct_tcp: Invalid dir=%i index=%u ostate=%u\n", | 910 | pr_debug("nf_ct_tcp: Invalid dir=%i index=%u ostate=%u\n", |
909 | dir, get_conntrack_index(th), old_state); | 911 | dir, get_conntrack_index(th), old_state); |
910 | write_unlock_bh(&tcp_lock); | 912 | write_unlock_bh(&tcp_lock); |
911 | if (LOG_INVALID(IPPROTO_TCP)) | 913 | if (LOG_INVALID(net, IPPROTO_TCP)) |
912 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 914 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
913 | "nf_ct_tcp: invalid state "); | 915 | "nf_ct_tcp: invalid state "); |
914 | return -NF_ACCEPT; | 916 | return -NF_ACCEPT; |
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index 3d3fffe3f8b9..7c2ca48698be 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
@@ -101,7 +101,7 @@ static int udp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | |||
101 | /* Header is too small? */ | 101 | /* Header is too small? */ |
102 | hdr = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); | 102 | hdr = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); |
103 | if (hdr == NULL) { | 103 | if (hdr == NULL) { |
104 | if (LOG_INVALID(IPPROTO_UDP)) | 104 | if (LOG_INVALID(net, IPPROTO_UDP)) |
105 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 105 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
106 | "nf_ct_udp: short packet "); | 106 | "nf_ct_udp: short packet "); |
107 | return -NF_ACCEPT; | 107 | return -NF_ACCEPT; |
@@ -109,7 +109,7 @@ static int udp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | |||
109 | 109 | ||
110 | /* Truncated/malformed packets */ | 110 | /* Truncated/malformed packets */ |
111 | if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) { | 111 | if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) { |
112 | if (LOG_INVALID(IPPROTO_UDP)) | 112 | if (LOG_INVALID(net, IPPROTO_UDP)) |
113 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 113 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
114 | "nf_ct_udp: truncated/malformed packet "); | 114 | "nf_ct_udp: truncated/malformed packet "); |
115 | return -NF_ACCEPT; | 115 | return -NF_ACCEPT; |
@@ -125,7 +125,7 @@ static int udp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, | |||
125 | * FIXME: Source route IP option packets --RR */ | 125 | * FIXME: Source route IP option packets --RR */ |
126 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && | 126 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && |
127 | nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) { | 127 | nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) { |
128 | if (LOG_INVALID(IPPROTO_UDP)) | 128 | if (LOG_INVALID(net, IPPROTO_UDP)) |
129 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 129 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
130 | "nf_ct_udp: bad UDP checksum "); | 130 | "nf_ct_udp: bad UDP checksum "); |
131 | return -NF_ACCEPT; | 131 | return -NF_ACCEPT; |
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c index 3d1697c4f916..d22d839e4f94 100644 --- a/net/netfilter/nf_conntrack_proto_udplite.c +++ b/net/netfilter/nf_conntrack_proto_udplite.c | |||
@@ -104,7 +104,7 @@ static int udplite_error(struct net *net, | |||
104 | /* Header is too small? */ | 104 | /* Header is too small? */ |
105 | hdr = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); | 105 | hdr = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); |
106 | if (hdr == NULL) { | 106 | if (hdr == NULL) { |
107 | if (LOG_INVALID(IPPROTO_UDPLITE)) | 107 | if (LOG_INVALID(net, IPPROTO_UDPLITE)) |
108 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 108 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
109 | "nf_ct_udplite: short packet "); | 109 | "nf_ct_udplite: short packet "); |
110 | return -NF_ACCEPT; | 110 | return -NF_ACCEPT; |
@@ -114,7 +114,7 @@ static int udplite_error(struct net *net, | |||
114 | if (cscov == 0) | 114 | if (cscov == 0) |
115 | cscov = udplen; | 115 | cscov = udplen; |
116 | else if (cscov < sizeof(*hdr) || cscov > udplen) { | 116 | else if (cscov < sizeof(*hdr) || cscov > udplen) { |
117 | if (LOG_INVALID(IPPROTO_UDPLITE)) | 117 | if (LOG_INVALID(net, IPPROTO_UDPLITE)) |
118 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 118 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
119 | "nf_ct_udplite: invalid checksum coverage "); | 119 | "nf_ct_udplite: invalid checksum coverage "); |
120 | return -NF_ACCEPT; | 120 | return -NF_ACCEPT; |
@@ -122,7 +122,7 @@ static int udplite_error(struct net *net, | |||
122 | 122 | ||
123 | /* UDPLITE mandates checksums */ | 123 | /* UDPLITE mandates checksums */ |
124 | if (!hdr->check) { | 124 | if (!hdr->check) { |
125 | if (LOG_INVALID(IPPROTO_UDPLITE)) | 125 | if (LOG_INVALID(net, IPPROTO_UDPLITE)) |
126 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 126 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
127 | "nf_ct_udplite: checksum missing "); | 127 | "nf_ct_udplite: checksum missing "); |
128 | return -NF_ACCEPT; | 128 | return -NF_ACCEPT; |
@@ -132,7 +132,7 @@ static int udplite_error(struct net *net, | |||
132 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && | 132 | if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && |
133 | nf_checksum_partial(skb, hooknum, dataoff, cscov, IPPROTO_UDP, | 133 | nf_checksum_partial(skb, hooknum, dataoff, cscov, IPPROTO_UDP, |
134 | pf)) { | 134 | pf)) { |
135 | if (LOG_INVALID(IPPROTO_UDPLITE)) | 135 | if (LOG_INVALID(net, IPPROTO_UDPLITE)) |
136 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, | 136 | nf_log_packet(pf, 0, skb, NULL, NULL, NULL, |
137 | "nf_ct_udplite: bad UDPLite checksum "); | 137 | "nf_ct_udplite: bad UDPLite checksum "); |
138 | return -NF_ACCEPT; | 138 | return -NF_ACCEPT; |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 5cd066379779..98106d4e89f0 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -365,7 +365,7 @@ static ctl_table nf_ct_sysctl_table[] = { | |||
365 | { | 365 | { |
366 | .ctl_name = NET_NF_CONNTRACK_LOG_INVALID, | 366 | .ctl_name = NET_NF_CONNTRACK_LOG_INVALID, |
367 | .procname = "nf_conntrack_log_invalid", | 367 | .procname = "nf_conntrack_log_invalid", |
368 | .data = &nf_ct_log_invalid, | 368 | .data = &init_net.ct.sysctl_log_invalid, |
369 | .maxlen = sizeof(unsigned int), | 369 | .maxlen = sizeof(unsigned int), |
370 | .mode = 0644, | 370 | .mode = 0644, |
371 | .proc_handler = &proc_dointvec_minmax, | 371 | .proc_handler = &proc_dointvec_minmax, |
@@ -403,8 +403,6 @@ static struct ctl_path nf_ct_path[] = { | |||
403 | { } | 403 | { } |
404 | }; | 404 | }; |
405 | 405 | ||
406 | EXPORT_SYMBOL_GPL(nf_ct_log_invalid); | ||
407 | |||
408 | static int nf_conntrack_standalone_init_sysctl(struct net *net) | 406 | static int nf_conntrack_standalone_init_sysctl(struct net *net) |
409 | { | 407 | { |
410 | struct ctl_table *table; | 408 | struct ctl_table *table; |
@@ -423,6 +421,7 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net) | |||
423 | 421 | ||
424 | table[1].data = &net->ct.count; | 422 | table[1].data = &net->ct.count; |
425 | table[3].data = &net->ct.sysctl_checksum; | 423 | table[3].data = &net->ct.sysctl_checksum; |
424 | table[4].data = &net->ct.sysctl_log_invalid; | ||
426 | 425 | ||
427 | net->ct.sysctl_header = register_net_sysctl_table(net, | 426 | net->ct.sysctl_header = register_net_sysctl_table(net, |
428 | nf_net_netfilter_sysctl_path, table); | 427 | nf_net_netfilter_sysctl_path, table); |
@@ -473,6 +472,7 @@ static int nf_conntrack_net_init(struct net *net) | |||
473 | if (ret < 0) | 472 | if (ret < 0) |
474 | goto out_proc; | 473 | goto out_proc; |
475 | net->ct.sysctl_checksum = 1; | 474 | net->ct.sysctl_checksum = 1; |
475 | net->ct.sysctl_log_invalid = 0; | ||
476 | ret = nf_conntrack_standalone_init_sysctl(net); | 476 | ret = nf_conntrack_standalone_init_sysctl(net); |
477 | if (ret < 0) | 477 | if (ret < 0) |
478 | goto out_sysctl; | 478 | goto out_sysctl; |