diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2007-11-13 23:31:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:53:34 -0500 |
commit | a92aa318b4b369091fd80433c80e62838db8bc1c (patch) | |
tree | e1deef70d36b654080a69d94beeeab14631c259e | |
parent | 33c732c36169d7022ad7d6eb474b0c9be43a2dc1 (diff) |
[IPV6]: Add raw6 drops counter.
Add raw drops counter for IPv6 in /proc/net/raw6 .
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/raw.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 807260d03586..ae314f3fea46 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -354,14 +354,14 @@ static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) | |||
354 | { | 354 | { |
355 | if ((raw6_sk(sk)->checksum || sk->sk_filter) && | 355 | if ((raw6_sk(sk)->checksum || sk->sk_filter) && |
356 | skb_checksum_complete(skb)) { | 356 | skb_checksum_complete(skb)) { |
357 | /* FIXME: increment a raw6 drops counter here */ | 357 | atomic_inc(&sk->sk_drops); |
358 | kfree_skb(skb); | 358 | kfree_skb(skb); |
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | /* Charge it to the socket. */ | 362 | /* Charge it to the socket. */ |
363 | if (sock_queue_rcv_skb(sk,skb)<0) { | 363 | if (sock_queue_rcv_skb(sk,skb)<0) { |
364 | /* FIXME: increment a raw6 drops counter here */ | 364 | atomic_inc(&sk->sk_drops); |
365 | kfree_skb(skb); | 365 | kfree_skb(skb); |
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
@@ -382,6 +382,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
382 | struct raw6_sock *rp = raw6_sk(sk); | 382 | struct raw6_sock *rp = raw6_sk(sk); |
383 | 383 | ||
384 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) { | 384 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) { |
385 | atomic_inc(&sk->sk_drops); | ||
385 | kfree_skb(skb); | 386 | kfree_skb(skb); |
386 | return NET_RX_DROP; | 387 | return NET_RX_DROP; |
387 | } | 388 | } |
@@ -405,7 +406,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
405 | 406 | ||
406 | if (inet->hdrincl) { | 407 | if (inet->hdrincl) { |
407 | if (skb_checksum_complete(skb)) { | 408 | if (skb_checksum_complete(skb)) { |
408 | /* FIXME: increment a raw6 drops counter here */ | 409 | atomic_inc(&sk->sk_drops); |
409 | kfree_skb(skb); | 410 | kfree_skb(skb); |
410 | return 0; | 411 | return 0; |
411 | } | 412 | } |
@@ -496,7 +497,7 @@ csum_copy_err: | |||
496 | as some normal condition. | 497 | as some normal condition. |
497 | */ | 498 | */ |
498 | err = (flags&MSG_DONTWAIT) ? -EAGAIN : -EHOSTUNREACH; | 499 | err = (flags&MSG_DONTWAIT) ? -EAGAIN : -EHOSTUNREACH; |
499 | /* FIXME: increment a raw6 drops counter here */ | 500 | atomic_inc(&sk->sk_drops); |
500 | goto out; | 501 | goto out; |
501 | } | 502 | } |
502 | 503 | ||
@@ -1254,7 +1255,7 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
1254 | srcp = inet_sk(sp)->num; | 1255 | srcp = inet_sk(sp)->num; |
1255 | seq_printf(seq, | 1256 | seq_printf(seq, |
1256 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 1257 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
1257 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p\n", | 1258 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
1258 | i, | 1259 | i, |
1259 | src->s6_addr32[0], src->s6_addr32[1], | 1260 | src->s6_addr32[0], src->s6_addr32[1], |
1260 | src->s6_addr32[2], src->s6_addr32[3], srcp, | 1261 | src->s6_addr32[2], src->s6_addr32[3], srcp, |
@@ -1266,7 +1267,7 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
1266 | 0, 0L, 0, | 1267 | 0, 0L, 0, |
1267 | sock_i_uid(sp), 0, | 1268 | sock_i_uid(sp), 0, |
1268 | sock_i_ino(sp), | 1269 | sock_i_ino(sp), |
1269 | atomic_read(&sp->sk_refcnt), sp); | 1270 | atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); |
1270 | } | 1271 | } |
1271 | 1272 | ||
1272 | static int raw6_seq_show(struct seq_file *seq, void *v) | 1273 | static int raw6_seq_show(struct seq_file *seq, void *v) |
@@ -1277,7 +1278,7 @@ static int raw6_seq_show(struct seq_file *seq, void *v) | |||
1277 | "local_address " | 1278 | "local_address " |
1278 | "remote_address " | 1279 | "remote_address " |
1279 | "st tx_queue rx_queue tr tm->when retrnsmt" | 1280 | "st tx_queue rx_queue tr tm->when retrnsmt" |
1280 | " uid timeout inode\n"); | 1281 | " uid timeout inode drops\n"); |
1281 | else | 1282 | else |
1282 | raw6_sock_seq_show(seq, v, raw6_seq_private(seq)->bucket); | 1283 | raw6_sock_seq_show(seq, v, raw6_seq_private(seq)->bucket); |
1283 | return 0; | 1284 | return 0; |