From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: bert hubert <bert.hubert@netherlabs.nl>,
cpw@lanl.gov, netdev@vger.kernel.org
Subject: Re: 2.6.18-rc6 memory mapped pcap truncates outgoing TCP packets, but not icmp
Date: Fri, 15 Sep 2006 22:16:17 +0200 [thread overview]
Message-ID: <450B0A11.2050608@trash.net> (raw)
In-Reply-To: <20060915120235.GA9833@outpost.ds9a.nl>
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
bert hubert wrote:
>>It appears to be intentionally, but I don't see a reason for it.
>>Can you try if this patch makes it work as expected?
>
>
>>[PACKET]: Don't truncate non-linear skbs with mmaped IO
>>
>>Non-linear skbs are truncated to their linear part with mmaped IO.
>>Fix by using skb_copy_bits instead of memcpy.
>
>
> Works very well for me! I hope this can make it into 2.6.18.
That would be fine with me, lets see what Dave thinks.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1332 bytes --]
[PACKET]: Don't truncate non-linear skbs with mmaped IO
Non-linear skbs are truncated to their linear part with mmaped IO.
Fix by using skb_copy_bits instead of memcpy.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 6e184976552a407c331f9b4e52b2c26fcae46ee7
tree 1bb4fc2b65179a51e795dc07908277b83cc0921a
parent 9f737633e6ee54fc174282d49b2559bd2208391d
author Patrick McHardy <kaber@trash.net> Thu, 14 Sep 2006 11:59:09 +0200
committer Patrick McHardy <kaber@trash.net> Thu, 14 Sep 2006 11:59:09 +0200
net/packet/af_packet.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index f9cef36..4172a52 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -626,8 +626,6 @@ static int tpacket_rcv(struct sk_buff *s
if ((int)snaplen < 0)
snaplen = 0;
}
- if (snaplen > skb->len-skb->data_len)
- snaplen = skb->len-skb->data_len;
spin_lock(&sk->sk_receive_queue.lock);
h = (struct tpacket_hdr *)packet_lookup_frame(po, po->head);
@@ -644,7 +642,7 @@ static int tpacket_rcv(struct sk_buff *s
status &= ~TP_STATUS_LOSING;
spin_unlock(&sk->sk_receive_queue.lock);
- memcpy((u8*)h + macoff, skb->data, snaplen);
+ skb_copy_bits(skb, 0, (u8*)h + macoff, snaplen);
h->tp_len = skb->len;
h->tp_snaplen = snaplen;
next prev parent reply other threads:[~2006-09-15 20:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-13 11:23 2.6.18-rc6 memory mapped pcap truncates outgoing TCP packets, but not icmp bert hubert
2006-09-13 18:44 ` Patrick McHardy
2006-09-14 8:56 ` bert hubert
2006-09-14 10:02 ` Patrick McHardy
2006-09-14 10:52 ` Alexey Kuznetsov
2006-09-15 12:02 ` bert hubert
2006-09-15 20:16 ` Patrick McHardy [this message]
2006-09-18 7:00 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=450B0A11.2050608@trash.net \
--to=kaber@trash.net \
--cc=bert.hubert@netherlabs.nl \
--cc=cpw@lanl.gov \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).