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 3/4] net-timestamp: tcp sockets return v6 errors on v6 sockets
Date: Tue, 25 Nov 2014 12:58:05 -0500 [thread overview]
Message-ID: <1416938286-14147-4-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>
TCP timestamping introduced MSG_ERRQUEUE handling for TCP sockets.
It always passed errorqueue requests onto ip_recv_error, but the
same tcp_recvmsg code may also be called for IPv6 sockets. In that
case, pass to ipv6_recv_error.
Tested by asking for PKTINFO with
Documentation/networking/timestamping/txtimestamp -I
Before this change, IPv6 sockets would return AF_INET/IP_PKTINFO
after the change, these sockets return AF_INET6/IPV6_PKTINFO
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/ipv4/tcp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index c239f47..04ea9b2 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1597,8 +1597,12 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
struct sk_buff *skb;
u32 urg_hole = 0;
- if (unlikely(flags & MSG_ERRQUEUE))
- return ip_recv_error(sk, msg, len, addr_len);
+ if (unlikely(flags & MSG_ERRQUEUE)) {
+ if (sk->sk_family == AF_INET6)
+ return ipv6_recv_error(sk, msg, len, addr_len);
+ else
+ return ip_recv_error(sk, msg, len, addr_len);
+ }
if (sk_can_busy_loop(sk) && skb_queue_empty(&sk->sk_receive_queue) &&
(sk->sk_state == TCP_ESTABLISHED))
--
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 ` [PATCH rfc 1/4] net-timestamp: pull headers for SOCK_STREAM Willem de Bruijn
2014-11-25 18:42 ` 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 ` Willem de Bruijn [this message]
2014-11-25 18:41 ` [PATCH rfc 3/4] net-timestamp: tcp sockets return v6 errors on v6 sockets 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-4-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).