diff options
author | Willem de Bruijn <willemb@google.com> | 2013-08-19 16:40:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-20 20:23:58 -0400 |
commit | 8bcdeaff5ed544704a9a691d4aef0adb3f9c5b8f (patch) | |
tree | a100df027287cf5e047dd8f9c651673afc8b6434 /net | |
parent | 8b64fd61474797acde426742e80028f5b1c4adf6 (diff) |
packet: restore packet statistics tp_packets to include drops
getsockopt PACKET_STATISTICS returns tp_packets + tp_drops. Commit
ee80fbf301 ("packet: account statistics only in tpacket_stats_u")
cleaned up the getsockopt PACKET_STATISTICS code.
This also changed semantics. Historically, tp_packets included
tp_drops on return. The commit removed the line that adds tp_drops
into tp_packets.
This patch reinstates the old semantics.
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/packet/af_packet.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 4b66c752eae5..75c8bbf598c8 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -3259,9 +3259,11 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, | |||
3259 | 3259 | ||
3260 | if (po->tp_version == TPACKET_V3) { | 3260 | if (po->tp_version == TPACKET_V3) { |
3261 | lv = sizeof(struct tpacket_stats_v3); | 3261 | lv = sizeof(struct tpacket_stats_v3); |
3262 | st.stats3.tp_packets += st.stats3.tp_drops; | ||
3262 | data = &st.stats3; | 3263 | data = &st.stats3; |
3263 | } else { | 3264 | } else { |
3264 | lv = sizeof(struct tpacket_stats); | 3265 | lv = sizeof(struct tpacket_stats); |
3266 | st.stats1.tp_packets += st.stats1.tp_drops; | ||
3265 | data = &st.stats1; | 3267 | data = &st.stats1; |
3266 | } | 3268 | } |
3267 | 3269 | ||