Skip to content

Commit 4746b36

Browse files
edumazetkuba-moo
authored andcommitted
sctp: support MSG_ERRQUEUE flag in recvmsg()
For some reason sctp_poll() generates EPOLLERR if sk->sk_error_queue is not empty but recvmsg() can not drain the error queue yet. This is needed to better support timestamping. I had to export inet_recv_error(), since sctp can be compiled as a module. Signed-off-by: Eric Dumazet <[email protected]> Cc: Marcelo Ricardo Leitner <[email protected]> Cc: Willem de Bruijn <[email protected]> Acked-by: Xin Long <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 36d8afb commit 4746b36

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

net/ipv4/af_inet.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,7 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
16331633
#endif
16341634
return -EINVAL;
16351635
}
1636+
EXPORT_SYMBOL(inet_recv_error);
16361637

16371638
int inet_gro_complete(struct sk_buff *skb, int nhoff)
16381639
{

net/sctp/socket.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,6 +2099,9 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
20992099
pr_debug("%s: sk:%p, msghdr:%p, len:%zd, flags:0x%x, addr_len:%p)\n",
21002100
__func__, sk, msg, len, flags, addr_len);
21012101

2102+
if (unlikely(flags & MSG_ERRQUEUE))
2103+
return inet_recv_error(sk, msg, len, addr_len);
2104+
21022105
lock_sock(sk);
21032106

21042107
if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED) &&

0 commit comments

Comments
 (0)