lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Nov 2014 12:58:03 -0500
From:	Willem de Bruijn <willemb@...gle.com>
To:	netdev@...r.kernel.org
Cc:	davem@...emloft.net, luto@...capital.net, richardcochran@...il.com,
	Willem de Bruijn <willemb@...gle.com>
Subject: [PATCH rfc 1/4] net-timestamp: pull headers for SOCK_STREAM

From: Willem de Bruijn <willemb@...gle.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@...gle.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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ