From: Willem de Bruijn <willemb@google.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, luto@amacapital.net,
richardcochran@gmail.com, Willem de Bruijn <willemb@google.com>
Subject: [PATCH rfc 1/4] net-timestamp: pull headers for SOCK_STREAM
Date: Tue, 25 Nov 2014 12:58:03 -0500 [thread overview]
Message-ID: <1416938286-14147-2-git-send-email-willemb@google.com> (raw)
In-Reply-To: <1416938286-14147-1-git-send-email-willemb@google.com>
From: Willem de Bruijn <willemb@google.com>
When returning timestamped packets on the error queue, only return
the data that the application initially sent: not the protocol
headers.
This changes the ABI. The TCP interface is new enough that it should
be safe to do so. The UDP interface could be changed analogously with
+ else if (sk->sk_protocol == IPPROTO_UDP)
+ skb_pull(skb, skb_transport_offset(skb) + sizeof(struct udphdr));
Tested with Documentation/networking/timestamping/txtimestamp -l 60 -x
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/core/skbuff.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 92116df..70a8596 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3580,6 +3580,7 @@ static void __skb_complete_tx_timestamp(struct sk_buff *skb,
int tstype)
{
struct sock_exterr_skb *serr;
+ bool is_tcp = sk->sk_protocol == IPPROTO_TCP;
int err;
serr = SKB_EXT_ERR(skb);
@@ -3589,10 +3590,13 @@ static void __skb_complete_tx_timestamp(struct sk_buff *skb,
serr->ee.ee_info = tstype;
if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) {
serr->ee.ee_data = skb_shinfo(skb)->tskey;
- if (sk->sk_protocol == IPPROTO_TCP)
+ if (is_tcp)
serr->ee.ee_data -= sk->sk_tskey;
}
+ if (is_tcp)
+ skb_pull(skb, skb_transport_offset(skb) + tcp_hdrlen(skb));
+
err = sock_queue_err_skb(sk, skb);
if (err)
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-11-25 17:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-25 17:58 [PATCH rfc 0/4] timestamping updates Willem de Bruijn
2014-11-25 17:58 ` Willem de Bruijn [this message]
2014-11-25 18:42 ` [PATCH rfc 1/4] net-timestamp: pull headers for SOCK_STREAM David Miller
2014-11-25 19:52 ` Willem de Bruijn
2014-11-25 19:54 ` David Miller
2014-11-25 21:39 ` Andy Lutomirski
2014-11-26 21:03 ` Willem de Bruijn
2014-11-27 0:36 ` Andy Lutomirski
2014-11-27 12:30 ` Richard Cochran
2014-11-25 17:58 ` [PATCH rfc 2/4] net-errqueue: add IP(V6)_PKTINFO support Willem de Bruijn
2014-11-25 18:04 ` Willem de Bruijn
2014-11-25 18:41 ` David Miller
2014-11-25 21:16 ` Willem de Bruijn
2014-11-25 17:58 ` [PATCH rfc 3/4] net-timestamp: tcp sockets return v6 errors on v6 sockets Willem de Bruijn
2014-11-25 18:41 ` David Miller
2014-11-25 19:53 ` Willem de Bruijn
2014-11-25 17:58 ` [PATCH rfc 4/4] net-timestamp: expand txtimestamp test with payload and PKTINFO Willem de Bruijn
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=1416938286-14147-2-git-send-email-willemb@google.com \
--to=willemb@google.com \
--cc=davem@davemloft.net \
--cc=luto@amacapital.net \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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).