aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-10-08 05:35:07 -0400
committerPatrick McHardy <kaber@trash.net>2008-10-08 05:35:07 -0400
commita71996fccce4b2086a26036aa3c915365ca36926 (patch)
treeb029e46dccaa8eceabe44d67ae887630b8acccd2 /net
parent678d66753091a4102910392fb6198a6c6ce7f510 (diff)
netfilter: netns nf_conntrack: pass conntrack to nf_conntrack_event_cache() not skb
This is cleaner, we already know conntrack to which event is relevant. 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.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_helper.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c2
-rw-r--r--net/netfilter/nf_conntrack_core.c10
-rw-r--r--net/netfilter/nf_conntrack_ftp.c9
-rw-r--r--net/netfilter/nf_conntrack_proto_gre.c2
-rw-r--r--net/netfilter/nf_conntrack_proto_sctp.c4
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c6
-rw-r--r--net/netfilter/nf_conntrack_proto_udp.c2
-rw-r--r--net/netfilter/nf_conntrack_proto_udplite.c2
-rw-r--r--net/netfilter/xt_CONNMARK.c8
-rw-r--r--net/netfilter/xt_CONNSECMARK.c2
12 files changed, 26 insertions, 25 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 8c7ed5bc9590..205ba399d4a3 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -91,7 +91,7 @@ static int icmp_packet(struct nf_conn *ct,
91 nf_ct_kill_acct(ct, ctinfo, skb); 91 nf_ct_kill_acct(ct, ctinfo, skb);
92 } else { 92 } else {
93 atomic_inc(&ct->proto.icmp.count); 93 atomic_inc(&ct->proto.icmp.count);
94 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb); 94 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, ct);
95 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmp_timeout); 95 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmp_timeout);
96 } 96 }
97 97
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index 112dcfa12900..cf7a42bf9820 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -193,7 +193,7 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
193 nf_conntrack_tcp_update(skb, ip_hdrlen(skb), 193 nf_conntrack_tcp_update(skb, ip_hdrlen(skb),
194 ct, CTINFO2DIR(ctinfo)); 194 ct, CTINFO2DIR(ctinfo));
195 195
196 nf_conntrack_event_cache(IPCT_NATSEQADJ, skb); 196 nf_conntrack_event_cache(IPCT_NATSEQADJ, ct);
197 } 197 }
198 return 1; 198 return 1;
199} 199}
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index aabddfe21278..df04de91e6ef 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -93,7 +93,7 @@ static int icmpv6_packet(struct nf_conn *ct,
93 nf_ct_kill_acct(ct, ctinfo, skb); 93 nf_ct_kill_acct(ct, ctinfo, skb);
94 } else { 94 } else {
95 atomic_inc(&ct->proto.icmp.count); 95 atomic_inc(&ct->proto.icmp.count);
96 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb); 96 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, ct);
97 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmpv6_timeout); 97 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmpv6_timeout);
98 } 98 }
99 99
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 251f020c7c10..01f59c57730a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -370,14 +370,14 @@ __nf_conntrack_confirm(struct sk_buff *skb)
370 spin_unlock_bh(&nf_conntrack_lock); 370 spin_unlock_bh(&nf_conntrack_lock);
371 help = nfct_help(ct); 371 help = nfct_help(ct);
372 if (help && help->helper) 372 if (help && help->helper)
373 nf_conntrack_event_cache(IPCT_HELPER, skb); 373 nf_conntrack_event_cache(IPCT_HELPER, ct);
374#ifdef CONFIG_NF_NAT_NEEDED 374#ifdef CONFIG_NF_NAT_NEEDED
375 if (test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status) || 375 if (test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status) ||
376 test_bit(IPS_DST_NAT_DONE_BIT, &ct->status)) 376 test_bit(IPS_DST_NAT_DONE_BIT, &ct->status))
377 nf_conntrack_event_cache(IPCT_NATINFO, skb); 377 nf_conntrack_event_cache(IPCT_NATINFO, ct);
378#endif 378#endif
379 nf_conntrack_event_cache(master_ct(ct) ? 379 nf_conntrack_event_cache(master_ct(ct) ?
380 IPCT_RELATED : IPCT_NEW, skb); 380 IPCT_RELATED : IPCT_NEW, ct);
381 return NF_ACCEPT; 381 return NF_ACCEPT;
382 382
383out: 383out:
@@ -740,7 +740,7 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
740 } 740 }
741 741
742 if (set_reply && !test_and_set_bit(IPS_SEEN_REPLY_BIT, &ct->status)) 742 if (set_reply && !test_and_set_bit(IPS_SEEN_REPLY_BIT, &ct->status))
743 nf_conntrack_event_cache(IPCT_STATUS, skb); 743 nf_conntrack_event_cache(IPCT_STATUS, ct);
744 744
745 return ret; 745 return ret;
746} 746}
@@ -853,7 +853,7 @@ acct:
853 853
854 /* must be unlocked when calling event cache */ 854 /* must be unlocked when calling event cache */
855 if (event) 855 if (event)
856 nf_conntrack_event_cache(event, skb); 856 nf_conntrack_event_cache(event, ct);
857} 857}
858EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct); 858EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct);
859 859
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index bb20672fe036..4f7107107e99 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -318,7 +318,8 @@ static int find_nl_seq(u32 seq, const struct nf_ct_ftp_master *info, int dir)
318} 318}
319 319
320/* We don't update if it's older than what we have. */ 320/* We don't update if it's older than what we have. */
321static void update_nl_seq(u32 nl_seq, struct nf_ct_ftp_master *info, int dir, 321static void update_nl_seq(struct nf_conn *ct, u32 nl_seq,
322 struct nf_ct_ftp_master *info, int dir,
322 struct sk_buff *skb) 323 struct sk_buff *skb)
323{ 324{
324 unsigned int i, oldest = NUM_SEQ_TO_REMEMBER; 325 unsigned int i, oldest = NUM_SEQ_TO_REMEMBER;
@@ -336,11 +337,11 @@ static void update_nl_seq(u32 nl_seq, struct nf_ct_ftp_master *info, int dir,
336 337
337 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) { 338 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) {
338 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq; 339 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq;
339 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, skb); 340 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, ct);
340 } else if (oldest != NUM_SEQ_TO_REMEMBER && 341 } else if (oldest != NUM_SEQ_TO_REMEMBER &&
341 after(nl_seq, info->seq_aft_nl[dir][oldest])) { 342 after(nl_seq, info->seq_aft_nl[dir][oldest])) {
342 info->seq_aft_nl[dir][oldest] = nl_seq; 343 info->seq_aft_nl[dir][oldest] = nl_seq;
343 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, skb); 344 nf_conntrack_event_cache(IPCT_HELPINFO_VOLATILE, ct);
344 } 345 }
345} 346}
346 347
@@ -509,7 +510,7 @@ out_update_nl:
509 /* Now if this ends in \n, update ftp info. Seq may have been 510 /* Now if this ends in \n, update ftp info. Seq may have been
510 * adjusted by NAT code. */ 511 * adjusted by NAT code. */
511 if (ends_in_nl) 512 if (ends_in_nl)
512 update_nl_seq(seq, ct_ftp_info, dir, skb); 513 update_nl_seq(ct, seq, ct_ftp_info, dir, skb);
513 out: 514 out:
514 spin_unlock_bh(&nf_ftp_lock); 515 spin_unlock_bh(&nf_ftp_lock);
515 return ret; 516 return ret;
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c
index c5a78220fa38..5b1273a01fe3 100644
--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -229,7 +229,7 @@ static int gre_packet(struct nf_conn *ct,
229 ct->proto.gre.stream_timeout); 229 ct->proto.gre.stream_timeout);
230 /* Also, more likely to be important, and not a probe. */ 230 /* Also, more likely to be important, and not a probe. */
231 set_bit(IPS_ASSURED_BIT, &ct->status); 231 set_bit(IPS_ASSURED_BIT, &ct->status);
232 nf_conntrack_event_cache(IPCT_STATUS, skb); 232 nf_conntrack_event_cache(IPCT_STATUS, ct);
233 } else 233 } else
234 nf_ct_refresh_acct(ct, ctinfo, skb, 234 nf_ct_refresh_acct(ct, ctinfo, skb,
235 ct->proto.gre.timeout); 235 ct->proto.gre.timeout);
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index b5a90596d3f4..ae8c2609e230 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -369,7 +369,7 @@ static int sctp_packet(struct nf_conn *ct,
369 369
370 ct->proto.sctp.state = new_state; 370 ct->proto.sctp.state = new_state;
371 if (old_state != new_state) 371 if (old_state != new_state)
372 nf_conntrack_event_cache(IPCT_PROTOINFO, skb); 372 nf_conntrack_event_cache(IPCT_PROTOINFO, ct);
373 } 373 }
374 write_unlock_bh(&sctp_lock); 374 write_unlock_bh(&sctp_lock);
375 375
@@ -380,7 +380,7 @@ static int sctp_packet(struct nf_conn *ct,
380 new_state == SCTP_CONNTRACK_ESTABLISHED) { 380 new_state == SCTP_CONNTRACK_ESTABLISHED) {
381 pr_debug("Setting assured bit\n"); 381 pr_debug("Setting assured bit\n");
382 set_bit(IPS_ASSURED_BIT, &ct->status); 382 set_bit(IPS_ASSURED_BIT, &ct->status);
383 nf_conntrack_event_cache(IPCT_STATUS, skb); 383 nf_conntrack_event_cache(IPCT_STATUS, ct);
384 } 384 }
385 385
386 return NF_ACCEPT; 386 return NF_ACCEPT;
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 4e71de2405fb..b5d62d66e02c 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -969,9 +969,9 @@ static int tcp_packet(struct nf_conn *ct,
969 timeout = tcp_timeouts[new_state]; 969 timeout = tcp_timeouts[new_state];
970 write_unlock_bh(&tcp_lock); 970 write_unlock_bh(&tcp_lock);
971 971
972 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb); 972 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, ct);
973 if (new_state != old_state) 973 if (new_state != old_state)
974 nf_conntrack_event_cache(IPCT_PROTOINFO, skb); 974 nf_conntrack_event_cache(IPCT_PROTOINFO, ct);
975 975
976 if (!test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { 976 if (!test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
977 /* If only reply is a RST, we can consider ourselves not to 977 /* If only reply is a RST, we can consider ourselves not to
@@ -990,7 +990,7 @@ static int tcp_packet(struct nf_conn *ct,
990 after SYN_RECV or a valid answer for a picked up 990 after SYN_RECV or a valid answer for a picked up
991 connection. */ 991 connection. */
992 set_bit(IPS_ASSURED_BIT, &ct->status); 992 set_bit(IPS_ASSURED_BIT, &ct->status);
993 nf_conntrack_event_cache(IPCT_STATUS, skb); 993 nf_conntrack_event_cache(IPCT_STATUS, ct);
994 } 994 }
995 nf_ct_refresh_acct(ct, ctinfo, skb, timeout); 995 nf_ct_refresh_acct(ct, ctinfo, skb, timeout);
996 996
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index 8a245beb2c9e..e0ee89e179c1 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -75,7 +75,7 @@ static int udp_packet(struct nf_conn *ct,
75 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udp_timeout_stream); 75 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udp_timeout_stream);
76 /* Also, more likely to be important, and not a probe */ 76 /* Also, more likely to be important, and not a probe */
77 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) 77 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
78 nf_conntrack_event_cache(IPCT_STATUS, skb); 78 nf_conntrack_event_cache(IPCT_STATUS, ct);
79 } else 79 } else
80 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udp_timeout); 80 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udp_timeout);
81 81
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c
index 981701919a75..c5b77c8f86c2 100644
--- a/net/netfilter/nf_conntrack_proto_udplite.c
+++ b/net/netfilter/nf_conntrack_proto_udplite.c
@@ -75,7 +75,7 @@ static int udplite_packet(struct nf_conn *ct,
75 nf_ct_udplite_timeout_stream); 75 nf_ct_udplite_timeout_stream);
76 /* Also, more likely to be important, and not a probe */ 76 /* Also, more likely to be important, and not a probe */
77 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) 77 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
78 nf_conntrack_event_cache(IPCT_STATUS, skb); 78 nf_conntrack_event_cache(IPCT_STATUS, ct);
79 } else 79 } else
80 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udplite_timeout); 80 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udplite_timeout);
81 81
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c
index e72e5d017525..e1415c3f5c91 100644
--- a/net/netfilter/xt_CONNMARK.c
+++ b/net/netfilter/xt_CONNMARK.c
@@ -54,7 +54,7 @@ connmark_tg_v0(struct sk_buff *skb, const struct net_device *in,
54 newmark = (ct->mark & ~markinfo->mask) | markinfo->mark; 54 newmark = (ct->mark & ~markinfo->mask) | markinfo->mark;
55 if (newmark != ct->mark) { 55 if (newmark != ct->mark) {
56 ct->mark = newmark; 56 ct->mark = newmark;
57 nf_conntrack_event_cache(IPCT_MARK, skb); 57 nf_conntrack_event_cache(IPCT_MARK, ct);
58 } 58 }
59 break; 59 break;
60 case XT_CONNMARK_SAVE: 60 case XT_CONNMARK_SAVE:
@@ -62,7 +62,7 @@ connmark_tg_v0(struct sk_buff *skb, const struct net_device *in,
62 (skb->mark & markinfo->mask); 62 (skb->mark & markinfo->mask);
63 if (ct->mark != newmark) { 63 if (ct->mark != newmark) {
64 ct->mark = newmark; 64 ct->mark = newmark;
65 nf_conntrack_event_cache(IPCT_MARK, skb); 65 nf_conntrack_event_cache(IPCT_MARK, ct);
66 } 66 }
67 break; 67 break;
68 case XT_CONNMARK_RESTORE: 68 case XT_CONNMARK_RESTORE:
@@ -95,7 +95,7 @@ connmark_tg(struct sk_buff *skb, const struct net_device *in,
95 newmark = (ct->mark & ~info->ctmask) ^ info->ctmark; 95 newmark = (ct->mark & ~info->ctmask) ^ info->ctmark;
96 if (ct->mark != newmark) { 96 if (ct->mark != newmark) {
97 ct->mark = newmark; 97 ct->mark = newmark;
98 nf_conntrack_event_cache(IPCT_MARK, skb); 98 nf_conntrack_event_cache(IPCT_MARK, ct);
99 } 99 }
100 break; 100 break;
101 case XT_CONNMARK_SAVE: 101 case XT_CONNMARK_SAVE:
@@ -103,7 +103,7 @@ connmark_tg(struct sk_buff *skb, const struct net_device *in,
103 (skb->mark & info->nfmask); 103 (skb->mark & info->nfmask);
104 if (ct->mark != newmark) { 104 if (ct->mark != newmark) {
105 ct->mark = newmark; 105 ct->mark = newmark;
106 nf_conntrack_event_cache(IPCT_MARK, skb); 106 nf_conntrack_event_cache(IPCT_MARK, ct);
107 } 107 }
108 break; 108 break;
109 case XT_CONNMARK_RESTORE: 109 case XT_CONNMARK_RESTORE:
diff --git a/net/netfilter/xt_CONNSECMARK.c b/net/netfilter/xt_CONNSECMARK.c
index ae939e54dfaa..5f221c3bd35c 100644
--- a/net/netfilter/xt_CONNSECMARK.c
+++ b/net/netfilter/xt_CONNSECMARK.c
@@ -43,7 +43,7 @@ static void secmark_save(const struct sk_buff *skb)
43 ct = nf_ct_get(skb, &ctinfo); 43 ct = nf_ct_get(skb, &ctinfo);
44 if (ct && !ct->secmark) { 44 if (ct && !ct->secmark) {
45 ct->secmark = skb->secmark; 45 ct->secmark = skb->secmark;
46 nf_conntrack_event_cache(IPCT_SECMARK, skb); 46 nf_conntrack_event_cache(IPCT_SECMARK, ct);
47 } 47 }
48 } 48 }
49} 49}